curl-and-php
Re: curl-and-php Digest, Vol 56, Issue 2
Date: Thu, 8 Apr 2010 23:01:16 -0400
I tried it, and got the same problem - must be a bug in PHP...
I'm not sure what you're trying to verify here, but if you're just trying to
make sure that the same data is going through HTTP as HTTPS, you could
simply compare the content-length fields.
-Stephen
On Thu, Apr 8, 2010 at 21:41, Peter Miller <petermiller1986_at_gmail.com>wrote:
> thanks for the quick response! unfortunately, as daniel.haxx.se says, http
> headers only shows http requests between the browser and curl script. i do
> use the browser to display the output of my curl script, which is great for
> displaying the returned html from the site i'm contacting, however since the
> curl http requests do not pass though the browser the live http headers
> program does not log them. check it out for yourself with this simple
> example program:
> <?php
> $ch = curl_init();
> curl_setopt($ch,CURLOPT_URL,"http://curl.haxx.se/");
> curl_setopt($ch,CURLOPT_POST,1);
>
> curl_setopt($ch,CURLOPT_POSTFIELDS,'post_variable=try+to+find+this+post+request+in+the+live+http+headers+program');
> curl_exec($ch);
> ?>
> if you turn live http headers on in the browser before navigating to this
> curl script in your browser you will notice that the post string never shows
> up in the live http headers. its kind of like:
>
> |browser|--------a----------|curl script|---------b----------|remote site (
> http://curl.haxx.se/ in the example)|
>
> and live http headers sees everything passing though link 'a' but not 'b'.
> as i mentioned below you can place a proxy server at link b but i recon
> there must be an easier way than this.
>
> > from daniel.haxx.se:
> >I'm really not a PHP guy, but I believe recent PHP/CURL code allows you to
> do
> >something like this:
> > $headers = curl_getinfo($c, CURLINFO_HEADER_OUT);
>
> that sounded really promising but when i tried it no post variables show up
> in the outgoing header :( eg:
> <?php
> $ch = curl_init();
> curl_setopt($ch,CURLOPT_URL,"http://curl.haxx.se/");
> curl_setopt($ch,CURLOPT_POST,1);
> curl_setopt($ch,CURLOPT_POSTFIELDS,'post_variable=var1');
> curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
> curl_setopt($ch,CURLINFO_HEADER_OUT,1);
> curl_exec($ch);
> echo "outgoing headers:<br>".curl_getinfo($ch,CURLINFO_HEADER_OUT);
> ?>
>
> even if you replace the last line in that script with:
> echo "all curl info for this
> transfer:<br>".print_r(curl_getinfo($ch),true);
> it shows you all the info you can get from the curl transfer and the post
> fields are not in there.
>
> Message: 5
>> Date: Thu, 8 Apr 2010 09:14:59 +0200
>> From: "YupLounge website analyse en optimalisatie"
>> <info_at_yuplounge.com>
>> To: "'curl with PHP'" <curl-and-php_at_cool.haxx.se>
>> Subject: RE: view outgoing post string?
>> Message-ID: <C1E9C29DF1014156BCEEFC4AC9EAA520_at_yuploung008f4f>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> Use http header for firefox: https://addons.mozilla.org/addon/3829
>>
>> Than you can read everything which is being send and being received.
>>
>>
>>
>> _____
>>
>> Van: curl-and-php-bounces_at_cool.haxx.se
>> [mailto:curl-and-php-bounces_at_cool.haxx.se] Namens Peter Miller
>> Verzonden: donderdag 8 april 2010 4:57
>> Aan: curl-and-php_at_cool.haxx.se
>> Onderwerp: view outgoing post string?
>>
>>
>>
>> hi,
>> i would like to be able to see the outgoing post variables from my php
>> curl
>> script, is there any simple way to do this? the reason i ask is that there
>> appears to be a discrpancy between the post variables i pass to curl with
>>
>> curl_setopt($ch,CURLOPT_POST,1);
>> curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
>>
>> and the post variables exiting curl as https.
>>
>> i've tried to observe the output myself by running everything though a
>> proxy
>> (webscarab), like so:
>> curl_setopt($ch,CURLOPT_HTTPPROXYTUNNEL,0);
>> curl_setopt($ch,CURLOPT_PROXY,"http://127.0.0.1:8008"); //webscarab
>> operats
>> on localhost (127.0.0.1), port 8008 by default
>>
>> this would work fine, except that im using https and i can't figure out
>> how
>> to get the certificate into the correct format (but that's beside the
>> point
>> of this message).
>>
>> so yeah the easiest thing would be if i could just view the outgoing post
>> string. unfortunately neither curl_setopt($ch,CURLOPT_VERBOSE,1);
>> or
>> curl_setopt($ch,CURLOPT_HEADER,1); show me the post string.
>>
>> any help would be much appreciated!
>>
>> Peter Miller
>>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2010-04-09