Re: [PHP] Problems posting xml file with curl and php

2008-03-18 Thread Michael Horowitz
I've actually tried that and it didn't work for the server I am sending 
it to.  Is there a way to post just the xml without turning it into an 
array or is this the only way. 





Nathan Nobbe wrote:
On Tue, Mar 18, 2008 at 4:26 PM, michaelh613 
<[EMAIL PROTECTED] 
> wrote:



I have created a XML string using PHP DOM.  However when I send it
to a third
party using curl it shows up as part of an array and cannot be
read.  How
should I be using curl to post a xml file.

My code is below
[code]
asXML();
$ch= curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Accept: text/xml"));
curl_setopt($ch, CURLOPT_URL, "http://testurl.com";);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlResult);
curl_setopt($ch, CURLOPT_POST,1);
curl_exec($ch);
[/code]


CURLOPT_POSTFIELDS must be specified as an array, therefore you will 
need to conjure up some identifier and place it your xml in an array 
as follows,


curl_setopt($ch, CURLOPT_POSTFIELDS, array('xml' => $xmlResult));

-nathan



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



Re: [PHP] Problems posting xml file with curl and php

2008-03-18 Thread Michael Horowitz
Not much documentation there.  How would this function be integrated 
with curl.  my quick google doesn't show much discussion of this function.


Michael Horowitz
Your Computer Consultant
http://yourcomputerconsultant.com
561-394-9079



Nathan Nobbe wrote:
On Tue, Mar 18, 2008 at 4:37 PM, Michael Horowitz 
<[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]>> wrote:


I've actually tried that and it didn't work for the server I am
sending
it to.  Is there a way to post just the xml without turning it into an
array or is this the only way.


i dont know how to do it w/ the standard curl functions in php, but 
you can do it w/ the http extension via

HttpRequest::addRawPostData()

http://us3.php.net/manual/en/function.HttpRequest-addRawPostData.php

-nathan


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



[PHP] Reading an xml file from a POST array

2008-04-02 Thread Michael Horowitz
Simple XML has great tools to read xml from a string or a file.  But I 
have it coming in as an http POST and none of them work.  Its coming in 
as a straight file and not as a variable = value pairing like a form does.


What is the best way to do this in PHP

Thanks for any help

--
Michael Horowitz
Your Computer Consultant
http://yourcomputerconsultant.com   
561-394-9079


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