php - 如何删除 PHP 中的 CURL 时间限制?

标签 php

我正在运行一个相当长的脚本,该脚本获取指定域的内容并在对所述 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

关于php - 如何删除 PHP 中的 CURL 时间限制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4858104/

相关文章:

php - 使用 PHP 解压/提取 zip 文件而不依赖任何扩展

php - mysqli_stmt::bind_param() 错误:使用连接进行查询

javascript - 通过curl获取数据时在新标签页(Javascript)中打开PDF

javascript - 邮件至 : add users dynamically to same email

javascript - 用javascript中的mysql数据库中的数据填充下拉列表

javascript - 如何在blade.php中使用外部.js文件中的代码?

javascript - 如何从 jquery ajax 调用中获取 js 中的 json 字符串?

php - 准备好的声明

PHP显示join查询结果

php - 我无法将数据插入数据库(codeigniter)