Re: Best way to post XML via curl?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/2/12 Brian Dunning <brian@xxxxxxxxxxxxxxxx>:
> 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.

The original code you had, minus the Content-Type header will do
exactly that. Either the documentation is wrong or there's something
wrong with their system.

I suggest you create an HTML file containing a form with those fields
that posts to the destination URL, fill it in with valid values and
see what happens when you post that. Remove CURL from the equation,
and if that doesn't work go back to them and show them that form and
the response you get, because according to that documentation it
should work.

-Stuart

> On Feb 11, 2009, at 5:08 PM, Stuart wrote:
>
>> 2009/2/12 Brian Dunning <brian@xxxxxxxxxxxxxxxx>:
>>>
>>> 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.
>>
>> -Stuart
>>
>>> On Feb 11, 2009, at 4:56 PM, Stuart wrote:
>>>
>>>>> curl_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.
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>> --
>> http://stut.net/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux