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