Troubleshooting Multi Curl Proxy Support

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
calebf
Forum Newbie
Posts: 1
Joined: Tue Mar 06, 2012 4:08 pm

Troubleshooting Multi Curl Proxy Support

Post by calebf »

I am trying to get multi curl to work with proxies. My script works fine without a proxy but as soon as I add the typical CURL options for using a proxy it fails to retrieve the pages. I have tried everything, triple checked to make sure my proxies were working, tried a variety of CURL options, etc. Nothing seems to work. Below is how I have it setup now, from what I can understand this configuration should work...

Code: Select all

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXY, $proxies[rand(0,count($proxies))]);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
Any ideas?
Post Reply