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


Re: curl and xml problem

From: Richard Lynch <>
Date: Thu, 27 Mar 2008 20:06:49 -0500 (CDT)

On Tue, March 18, 2008 3:58 pm, Daniel Stenberg wrote:
> On Tue, 18 Mar 2008, Michael Horowitz wrote:
>> Here is the code I am using. I am sending a string.
>> curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlResult);
> This this sends the data as a regular POST...
>> The xml shows up after it is posted as array(1) {
>> ["<?xml_version"]=>
>> string(972) "\"1.0\"?>
> ... and this weird splitting up the received data in "var=data" pairs
> is done
> by the receiving end => PHP code => stuff I know next to nothing
> about.

PHP expects the POST data to be, like, you know, regular POST data.


I also allows a rather nifty feature of passing in arrays:
results in:
array(0=>4, 1=>8)

If you send it raw XML, it's going to try and "parse" it as a POST body.

You can, however, access the "raw post data" if you turn that option
"on" in php.ini
always_populate_raw_post_data = 1

You would then read stdin like this:
$stdin = fopen('php://stdin', 'r') or die("Can't read stdin?!");
$xml = fread($stdin, 100000000); //or loop or...

Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
Yeah, I get a buck. So?
Received on 2008-03-28