PDA

Click to See Complete Forum and Search --> : cUrl using proxy


lordadel
May 16th, 2008, 01:06 AM
Hello

Can someone give me a working example on how to use cUrl with proxy?
There are tons of proxies out there.. will all of them work or what?

Thanks
cheers
Adel

lordadel
May 21st, 2008, 11:03 PM
Ok i have tried this but it's not working

<?php
$url = 'http://www.myip.dk/';
$ch = curl_init();
curl_setopt($ch, curlOPT_URL,$url);
curl_setopt($ch, curlOPT_HTTPproxyTUNNEL, 1);
curl_setopt($ch, curlOPT_proxy, '121.174.35.26:8080');
//curl_setopt($ch, curlOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, curlOPT_RETURNTRANSFER, 0);
curl_setopt($ch, curlOPT_CUSTOMREQUEST,'GET');
curl_setopt ($ch, curlOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10000);
$html = curl_exec($ch);

curl_close($ch);
echo '<br />';

echo $html;
?>

manavo11
May 22nd, 2008, 02:13 PM
Have a look at these:

http://www.webmasterworld.com/forum88/10572.htm
http://www.higherpass.com/php/tutorials/Using-Curl-To-Query-Remote-Servers/3/
http://www.decodephp.com/2007/02/26/php-curl-insight-and-a-php-alternative-example/