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

$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

After that, you send $request.


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 (
To unsubscribe, visit:

Reply via email to