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

curl-and-php

cURLing XML

From: Stephen Buckley <designer_at_passman.com>
Date: Thu, 20 Nov 2003 17:21:01 -0600

First off I'm new to cURL and I've many questions. I'm trying to utilize
cURL to send XML data(as a long string) with CURLOPT_POSTFIELDS as:

curl_setopt ($ch, CURLOPT_POSTFIELDS, $xml_data);

, but the data that gets sent is all just a name/value pair array, thus
mangling the XML text that the target server is expecting. Also, the
application that is receiving this data, as specified by the company, needs
the header items of the data to be set as the following:

curl_setopt($ch, CURLOPT_HTTPHEADER, array('POST / AUTHORIZE HTTP/1.0',
'MIME-Version: 1.0', 'Content-type: application/PTI21', 'Content-length:
value='.$ReqLen, 'Content-transfer-encoding: text', 'Request-number: 1',
'Document-type: Request');

I wasn't sure if anything here, specifically the 'Content-type', was the
cause for cURL messing up the XML string.

I've also seen in a previous post about trying:

curl_setopt ($ch, CURLOPT_POSTFIELDS, "<post field name>=<xml data>");

But that doesn't seem to work either.

I've noticed via other posts, that there are cURL C libraries that offer the
FormAdd functionality which seems to get around this, but I don't think C is
an option. Is there a workaround? Also, am I going to have to urlencode the
XML data that would get sent?

Thank you.

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-11-21