0
点赞
收藏
分享

微信扫一扫

Operation timed out after 10001 milliseconds with 0 bytes received

雷亚荣 2022-05-09 阅读 80

PHP Curl 请求接口时遇到下列错误!

{"error":"Operation timed out after 10001 milliseconds with 0 bytes received"}


{"error":"Empty reply from server"}


这两个问题,第一个问题大概意思是请求时间过长造成的。

解决办法:

// 超时设置

    curl_setopt($curl, CURLOPT_TIMEOUT, 300);


设置更大的时间

然鹅,造成整个问题的原因是:

$header = array(

                        'Content-Type: application/json',

                        'Content-Length: ' . strlen(json_encode($post_data))

                    );


Content-Length 对就是这个参数,造成的假死和timeout

参考链接: ​​https://www.jianshu.com/p/ea12be063b2e​​


__________________________________________________________________________________

若有帮助到您,欢迎点击推荐,您的支持是对我坚持最好的肯定(*^_^*)

你要保守你心,胜过保守一切。

作者:刘俊涛的博客​​




举报

相关推荐

frida timed out

0 条评论