Jump to content

Setting a time limit on a CURL lookup?


Anidazen

Recommended Posts

Is it possible to set a timelimit within PHP, such as if CURL doesn't fetch a page in 5 seconds, give up trying.

Only way I can see at the moment is to have an entire-script timeout and lookup some satellite scripts... hardly an efficient process.


Any ideas?
Link to comment
Share on other sites

Well, according to [url=http://www.phpit.net/article/using-curl-php/2/]http://www.phpit.net/article/using-curl-php/2/[/url]:

[quote]The CURLOPT_CONNECTTIMEOUT is used to set how long curl should wait whilst trying to connect. This is a very important option, since it could cause requests to fail if you set it too low, but if you set it too high (e.g. 1000 or 0 for unlimited) it could cause your PHP scripts to crash. A related option to this is the CURLOPT_TIMEOUT option, which is used to set how long curl requests are allowed to execute. If you set this to a low value, it might cause slow pages to be incomplete, since they take a while to download.

[/quote]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.