note 59481 deleted from ref.curl by danbrown

From: Date: Sun, 17 May 2009 19:35:45 +0000
Subject: note 59481 deleted from ref.curl by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155237@lists.php.net to get a copy of this message
Note Submitter: administrator at gesoft dot org ---- Hello everybody, The solution how to use proxy in correct way with curl was founded. Here is the part of code which was successfully used for checking proxy server and can be used by anybody as an example. During the research one very useful parameter of curl was discovered: CURLOPT_TIMEOUT. If script is using curl object with proxy parameter it is very important to set this parameter. There is possibility that proxy will not replay (die or big latency) until PHP script’s timeout exceed. $cUrl = curl_init(); curl_setopt($cUrl, CURLOPT_URL, $requestUrl); curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($cUrl, CURLOPT_TIMEOUT, 'timeout_in_seconds'); curl_setopt($cUrl, CURLOPT_PROXY, 'proxy_ip:proxy_port'); $pageContent = trim(curl_exec($cUrl)); curl_close($cUrl); Hope this post will be useful Sincerely yours Vitali Simsive P.S. The example of working script can be seen here http://proxy-list.org/admin/checkproxy.php?proxy=’ip:port’&timeout=sec If somebody is interesting to obtain personal copy of checkproxy.php please mail me.

« previous php.notes (#155237) next »