Re: Best way to post XML via curl?
| From: | Brian Dunning | Date: | Thu, 12 Feb 2009 01:53:29 +0000 |
| Subject: | Re: Best way to post XML via curl? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-288138@lists.php.net to get a copy of this message | ||
From the documentation:
Parameters
The following POST parameters are required:
login - Assigned
password - Assigned
method - newPrintRequest, updatePrintRequest, reprintRequest
orderxml - XML according to accompanying documentation
The error that I get says no method was provided, and if you look at my code, it clearly is.
On Feb 11, 2009, at 5:08 PM, Stuart wrote:
2009/2/12 Brian Dunning <brian@briandunning.com>:This line is the key. WITH the line, I get a properly formatted XML response from the server, telling me that I did not send any valid post fields. WITHOUT the line, all I get back from the server is a '1' and their tech reports that no valid call was received from me.In that case you're not sending them what they're asking for. Are the method, login and password fields supposed to be separate or should they be included in the xml? At the moment they're separate so when you tell the server it's in XML format you're lying because only part of it is. As a test try setting $postArgs = $xml. If I'm right it might either work or give you and authentication error. -StuartOn Feb 11, 2009, at 4:56 PM, Stuart wrote:--http://stut.net/-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpcurl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));Drop the above line and I reckon it should work. The content you're sending is not XML, it's form fields which CURL will default to. It just happens that one of those fields is XML.