cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: curl-and-php Digest, Vol 56, Issue 5

From: Peter Miller <petermiller1986_at_gmail.com>
Date: Tue, 13 Apr 2010 12:57:23 +0930

> 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
>
mm do you mean the php bug is that it doesnt show the outgoing post fields?
coz im not so sure that curl can do that in the linux shell either? i guess
the content length being the same is a good indication that the data is the
same. furthermore when i use http i can view the postfields with my proxy.
its a roundabout solution but i'll accept it :P
thanks for all your help!

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

>> 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
Received on 2010-04-13