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_CONNECT TIMEOUT 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_COOKIEJ AR, "/tmp/cookiejar-$randnum");
curl_setopt($ch , CURLOPT_COOKIEF ILE, "/tmp/cookiejar-$randnum");
curl_setopt($ch , CURLOPT_USERAGE NT, "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_FOLLOWL OCATION, 1);
curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
curl_setopt($ch , CURLOPT_PROXYTY PE, CURLPROXY_HTTP) ;
curl_setopt($ch , CURLOPT_PROXY," http://".$proxy['ip'].":".
$proxy['port']);
curl_setopt($ch , CURLOPT_HTTPHEA DER, Array("Content-Type: application/
x-www-form-urlencoded"));
curl_setopt($ch , CURLOPT_POST, 1);
curl_setopt($ch , CURLOPT_POSTFIE LDS,$postfields );
curl_setopt($ch , CURLOPT_REFERER , ...);
curl_setopt($ch , CURLOPT_URL, ...);
curl_setopt($ch , CURLOPT_CONNECT TIMEOUT,15);
curl_setopt($ch , CURLOPT_TIMEOUT ,30);
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_CONNECT TIMEOUT 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_COOKIEJ AR, "/tmp/cookiejar-$randnum");
curl_setopt($ch , CURLOPT_COOKIEF ILE, "/tmp/cookiejar-$randnum");
curl_setopt($ch , CURLOPT_USERAGE NT, "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_FOLLOWL OCATION, 1);
curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
curl_setopt($ch , CURLOPT_PROXYTY PE, CURLPROXY_HTTP) ;
curl_setopt($ch , CURLOPT_PROXY," http://".$proxy['ip'].":".
$proxy['port']);
curl_setopt($ch , CURLOPT_HTTPHEA DER, Array("Content-Type: application/
x-www-form-urlencoded"));
curl_setopt($ch , CURLOPT_POST, 1);
curl_setopt($ch , CURLOPT_POSTFIE LDS,$postfields );
curl_setopt($ch , CURLOPT_REFERER , ...);
curl_setopt($ch , CURLOPT_URL, ...);
curl_setopt($ch , CURLOPT_CONNECT TIMEOUT,15);
curl_setopt($ch , CURLOPT_TIMEOUT ,30);