Anidazen Posted August 9, 2006 Share Posted August 9, 2006 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? Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted August 9, 2006 Share Posted August 9, 2006 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.