Are you sure that the HTTP header should be on there?  I don't believe that
is correct.  It is the use of CURLOPT_POSTFIELDS with the curl_setopt
function that indicates that a POST is being made.

I just checked the code I used for credit card clearing & it does NOT
include the HTTP headers.  Just the POST data.

> -----Original Message-----
> From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, August 11, 2002 22:36 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: POST fields through CURL
>
>
> Yes, the strings are formatted exactly like GET strings, but you'll have
> to build the whole HTTP header in front of them in order to get a valid
> HTTP request. So then, your code should look something like
>
> $myvar1=rawurlencode($myvar1);
> $myvar2=rawurlencode($myvar2);
> $parsed="myvar1=$myvar1&myvar2=$myvar2";
> $len=strlen($parsed)
> $request="POST $request_path HTTP/1.0\r\n".
>           "Content-Type: application/x-www-form-urlencoded\r\n".
>           "User-Agent: My PHP application v1.0\r\n".
>           "Host: $host\r\n".
>           "Content-Length: $len\r\n".
>           "Connection: Keep-Alive\r\n".
>           "\r\n".         // This separates the header from the content
>           $parsed;
>
> After that, you send $request.
>
> Bogdan
>
> Mike Mannakee wrote:
> > Hi all,
> >
> > I'm setting up a curl operation with post fields, and I'm
> hoping someone can
> > tell me how the post fields are formatted.  I'm looking to pass
> a string to
> > curl_setopt( $ch, CURLOPT_POSTFIELDS, $string), but the
> specifications don't
> > tell one HOW to format the string.  Is it just like a GET
> string or what?
> > Anyone know?
> >
> > Thanks,
> >
> > Mike
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to