Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.