脚本宝典收集整理的这篇文章主要介绍了php – GCM卷曲操作超时,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
这是服务器的问题还是我的GCM代码有问题?下面是我的PHP文件:
<?PHP $message = urldecode($_POST['message']); $order = urldecode($_POST['order']); $registrationIDs = urldecode($_POST['registrationIDs']); $apiKey = "API_KEY"; $tableiD = urldecode($_POST['tableID']); $url = 'https://andROId.GOOGLEapis.COM/gcm/send'; $fields = array( 'registration_ids' => array($registrationIDs),'data' => array( 'message' => $message,'tableID' => $tableID,'order' => $order ),); $headers = array( 'Authorization: key=' . $apiKey,'Content-tyPE: application/json' ); // Open connection $ch = curl_init(); // Set the url,number of POST VARs,POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_HTTPHEADER,$headers); curl_setopt($ch,CURLOPT_RETURNtransfer,CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch,CURLOPT_POSTFIELDS,json_encode($fields)); // Execute post $result = curl_exec($ch); if(curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } // Close connection curl_close($ch); echo $result; ?>
现在你的问题,我已经搜索了可能发生的事情,因为看起来你有一个卷曲限制或什么,但我不是这个主题的专家所以这里有一些你可以尝试的提示:
>如果您通过浏览器运行脚本,则将set_time_limIT设置为零,持续无限秒.
参数或者set_time_limit(0);
>使用此选项’CURLOPT_TIMEOUT’增加卷曲的操作时间限制
curl_setopt($ch,CURLOPT_TIMEOUT,20); // 20秒
>从服务器进行无限重定向也会发生这种情况.要暂停此操作,请尝试在禁用后续位置的情况下运行脚本.
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,false);
以上是脚本宝典为你收集整理的php – GCM卷曲操作超时全部内容,希望文章能够帮你解决php – GCM卷曲操作超时所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。