Closed BadDeveloper2022 closed 6 years ago
`foreach ($copyBtns as $copyBtn){ $url = $copyBtn->getAttribute('data-clipboard-text'); $response = get($url); // 获取真实的红包URL $url = substr($response,strpos($response,'Location:')+strlen('Location:')); $url = substr($url,0,strpos($url,'device_id=')).'device_id='; $result = post(QIANG_HONG_BAO_API,["url"=>trim($url),"mobile"=>$mobile]); // 请求抢红包 echo $result . "\n"; //break; }
// 获取Response的Header部分 function get($url) { $oCurl = curl_init(); curl_setopt($oCurl, CURLOPT_URL,$url); curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($oCurl, CURLINFO_HEADER_OUT, TRUE); curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($oCurl, CURLOPT_HEADER, true); curl_setopt($oCurl, CURLOPT_NOBODY, true); $sContent = curl_exec($oCurl); $headerSize = curl_getinfo($oCurl, CURLINFO_HEADER_SIZE); $header = substr($sContent, 0, $headerSize); curl_close($oCurl); return $header; } `
改成这种就正常了
{"message":"请将信息填写完整"}