我正在运行一个相当长的脚本,它获取指定域的内容并在对所述html运行一系列测试之前解析html.无论如何,脚本会在一段时间后超时.我试过把它放在我的页面顶部,但仍然没有运气:
set_time_limit(0);
Run Code Online (Sandbox Code Playgroud)
这是有问题的错误:
cURL error number:28
cURL error:Operation timed out after 10000 milliseconds with 316183 out of 6476018 bytes received
Run Code Online (Sandbox Code Playgroud)
pro*_*php 22
您需要使用curl_setopt设置curl完成其操作所需的时间.
CURLOPT_TIMEOUT设置是特定的.
curl_setopt($ch, CURLOPT_TIMEOUT, 400); // the timeout in seconds
Run Code Online (Sandbox Code Playgroud)
http://www.php.net/manual/en/function.curl-setopt.php