Re: Problems with Curl and POST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/17/07, mbneto <mbneto@xxxxxxxxx> wrote:
Hi Richard,

I am using the same script.  And it is using the CURLOPT_POST.

- mb

On 4/16/07, Richard Lynch <ceo@xxxxxxxxx> wrote:
>
> HEAD is just like GET, only it gets just the headers (hence the name)
> usually to see if the document has changed according to LastModified:
> before doing a full-blown GET.
>
> There shouldn't be a HEAD done before a POST...
>
> Are you sure you are doing a CURLOPT_POST and not CURLOPT_GET...?
>
> On Mon, April 16, 2007 4:43 pm, mbneto wrote:
> > Hi,
> >
> > I am tring to use curl to access, via POST, a remote 'service'.
> > I've
> > managed to test it fine but when I use real data to feed the curl it
> > gives
> > me strange results.
> >
> > When I check the logs of the remote web server one thing that alarms
> > me is
> > that with test data I see
> >
> > A.B.C.D - - [16/Apr/2007:17:41:53 -0400] "POST /service.php HTTP/1.1"
> > 200 61
> >
> > with real data (using the same script)
> >
> > A.B.C.D - - [16/Apr/2007:17:48:55 -0400] "HEAD /service.php HTTP/1.1"
> > 200 -
> >
> > After reading the user contributed notes I found that it must be
> > related
> > with encoding.  But even if I use the suggested code
> >
> > $o="";                foreach ($post_data as $k=>$v)
> >                 {                        $o.=
> > "$k=".utf8_encode($v)."&";                }
> >                 $post_data=substr($o,0,-1);

echo $post_data; // Echo your data here to check if this is really
what you want to insert.
> > // Add error handling
> >                 if(!curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data)) {
echo curl_error($ch);
}
> >
> > I get the same results.
> >
> > Any tips?
> >
> > php 5.0.4

I guess you insert data twice, or something like that. I modified
above code, test it.

Tijnema
> >
>
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux