我正在运行一个相当长的脚本,它获取指定域的内容并解析 html,然后再对所述 html 运行一系列测试。无论如何,脚本在一段时间后超时。我尝试将其放在页面顶部,但仍然没有成功:
set_time_limit(0);
这是有问题的错误:
cURL error number:28
cURL error:Operation timed out after 10000 milliseconds with 316183 out of 6476018 bytes received
您需要使用curl_setopt 设置curl 完成其操作的时间量。
CURLOPT_TIMEOUT 设置要具体。
curl_setopt($ch, CURLOPT_TIMEOUT, 400); // the timeout in seconds
http://www.php.net/manual/en/function.curl-setopt.php http://www.php.net/manual/en/function.curl-setopt.php
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)