Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove CURL time limit in PHP?

Tags:

php

I am running a rather long script that fetches the contents of a specified domain and parses the html before running a series of tests on said html. Anyway the script times out after a while. I tried putting this at the top of my page but still no luck:

set_time_limit(0);

Here is the error in question:

cURL error number:28
cURL error:Operation timed out after 10000 milliseconds with 316183 out of 6476018 bytes received
like image 717
Sammy Avatar asked Feb 01 '11 01:02

Sammy


1 Answers

You need to set the amount of time curl gets to complete its operations with curl_setopt.

The CURLOPT_TIMEOUT setting to be specific.

curl_setopt($ch, CURLOPT_TIMEOUT, 400); // the timeout in seconds

http://www.php.net/manual/en/function.curl-setopt.php

like image 93
profitphp Avatar answered Sep 27 '22 23:09

profitphp