curl requests are not reaching proxy

Hi

I have a curl code which tries to open some URL.

If I access that url from browser it works fine but curl request is not returning anything.

I checked with the network guys , they say the request does not even come to proxy to block or allow the request.

I am supplying proxy paramenters to the curl request..though its not working…

Below is the code I am using (with test URL as google)

$filelocation="http://www.google.co.in";

$ch = curl_init();

curlsetopt($ch, CURLOPTURL, $filelocation);

curlsetopt($ch, CURLOPTHTTPPROXYTUNNEL,1);

curlsetopt($ch, CURLOPTPRXY, 'proxyname');

curlsetopt($ch, CURLOPTHTTPHEADER, array("Pragma: "));

curlsetopt($ch, CURLOPTPROXYPORT,'8080');

curlsetopt($ch, CURLOPTPROXYPWD, 'Username:Password');

curlsetopt($ch, CURLOPTRETURNTRANSFER,1);

$html=curl_exec($ch);

curl_close ($ch);

print $html;

exit;

Do anyone has a pointer ,with which I can debug this issue ? any other way to do it ? or something I need to modify in above code ?

Thanks,

Sourabh

1 Reply

Might you need HTTPUSERAGENT as well? I block requests that do not supply this to stop poorly written scanners and bots.

James

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct