views:

675

answers:

2

I need to make a cURL request to a https URL, but I have to go through a proxy as well. Is there some problem with doing this? I have been having so much trouble doing this with curl and php, that I tried doing it with urllib2 in Python, only to find that urllib2 cannot POST to https when going through a proxy. I haven't been able to find any documentation to this effect with cURL, but I was wondering if anyone knew if this was an issue?

A: 

No problem since the proxy server supports the CONNECT method.

Havenard
+1  A: 

I find testing with command-line curl a big help before moving to PHP/cURL.

For example, w/ command-line, unless you've configured certificates, you'll need -k switch. And to go through a proxy, it's the -x <proxyhost[:port]> switch.

I believe the -k equivalent is

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);

I believe the -x equivalent is

curl_setopt($curl, CURLOPT_PROXY, '<proxyhost[:port]>');


DISCLAIMER: I have not tested any of this. If you give more information about what you've tried, it might be helpful.

nicerobot