You are here: cURL timeout « PHP Programming Language « IT news, forums, messages
cURL timeout

Posted by sebastianrs on 06/08/07 13:57

Hello,

I have a serious problem with a script using cURL to access a site
using various different proxies. It appears that the PHP script always
stops executing if the connection to the proxy fails. I have tried
everything from setting the CURLOPT_CONNECTTIMEOUT to 30 seconds, or
even to 0 (unlimited). Same with CURLOPT_TIMEOUT.

What I want is that the PHP script continues to run (skip the proxy or
whatever). It simply doesn't work. Thanks in advance for any help!

Sebastian

PS: The curl options I use are:

curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookiejar-$randnum");
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookiejar-$randnum");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows
NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_PROXY,"http://".$proxy['ip'].":".
$proxy['port']);

curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/
x-www-form-urlencoded"));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postfields);
curl_setopt($ch, CURLOPT_REFERER, ...);
curl_setopt($ch, CURLOPT_URL, ...);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,15);
curl_setopt($ch, CURLOPT_TIMEOUT,30);

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация