Jump to content

Proxy works fine in FF but not in cURL ?


soma56

Recommended Posts

I'm working on an application that uses cURL but for the life of me I can't figure out why the proxy isn't working through cURL. The proxy works fine through Firefox. Here's a very simple example of cURL and with respect to how I'm trying to connect:

 

<?PHP

$url = 'http://www.mysite.com'; //URL to get

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1); // no headers in the output
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // output to variable
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0); 
curl_setopt($ch, CURLOPT_PROXY, 'IP:PORT'); 
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 25);
$data = curl_exec($ch);
curl_close($ch);

return $data;

echo $data;

?>

 

Can anyone suggest why this wouldn't work with a working proxy? I'm dying here....

Link to comment
https://forums.phpfreaks.com/topic/242792-proxy-works-fine-in-ff-but-not-in-curl/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.