views:

636

answers:

1

I'm using the app "Fiddler" to debug a GET attempt to a website via PHP cURL. In order to see the cURL traffic I had to specify that the cURL connection use the Fiddler proxy (see code below).

$ch = curl_init();

curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888'); 

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'read_header');  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);    
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_REFERER, "http://domain.com");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt");
curl_setopt($ch, CURLOPT_URL, "http://domain.com");

$response = curl_exec($ch);

But the problem is that in Fiddler I can only see this:

Request (domain.com is just an alias):

  CONNECT domain.com:80 HTTP/1.1

Response:

  HTTP/1.1 200 Blind-Connection Established

If I manually load the website in a browser Fiddler gives me WAY more information. I can see the cookies, the header information, and what I'm receiving via the GET.

Any ideas why Fiddler can't see more useful information from PHP cURL?

Edit: I tried turning on the "Enable HTTPS Decryption" option inside Tools / Fiddler Options / HTTPS (which I'm not sure why I'd need to use as I didn't tell cURL to use HTTPS).

Unfortunately, by changing this setting I now get a Response of:

HTTP/1.1 502 Connection failed

Edit: If it helps, the app "Charles" shows me WAY more information than Fiddler, but I really want to figure out Fiddler since I like it better.

+1  A: 

"Blind-Connection Established" suggests that you haven't turned on the "Enable HTTPS Decryption" option inside Tools / Fiddler Options / HTTPS.

EricLaw -MSFT-
Thanks Eric! Unfortunately after turning on that setting the Response is "HTTP/1.1 502 Connection failed".
Kane
CURLOPT_HTTPPROXYTUNNEL doesn't do what you think it does. If you don't set it, and just set CURLOPT_PROXY, it should work fine.
EricLaw -MSFT-