PHP Receiving XML -


I have been listening to a small PHP script which POST request I'm hoping to XML, always usually I am sending an XML request to that person But today I'm on the receiving side.

I thought it would be a simple matter to hear for $ _POST, but I think I might be wrong - I can not find anything.

Here's my script that looks for XML:

    

And here is a simple XML string that I am sending from any other location:

  & lt ;? Php $ xml_data = '& lt; note & gt; & LT; to & Gt; Tove & lt; & to / gt; & LT; a & gt; be & lt; / & gt; & LT; title & gt; reminder & lt; / title & gt; & Lt; body & gt; Don 't let me forget this weekend! & Lt; / body & gt; & Lt; / comment & gt; '; function sendXML2 server ($ url, $ xml) {$ xml_data = trim ($ xml); $ Ch = Krl_init ($ url); Curl_setopt ($ CH, CURLOPT_SSL_VERIFYHOST, 0); Curl_setopt ($ CH , CURLOPT_SSL_VERIFYPEER, 0); Curl_setopt ($ CH, CURLOPT_POST, 1); Curl_setopt ($ c, CURLOPT_HTTPHEADER, array ('content-type: text / xml')); Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ xml_data); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); $ output = Krl_akssi ($ CH); curl_close ($ ch); return $ output;} Echo sendXML2 server ( 'https://someurl.com/inboundxml.php',$xml_data)? & Gt;   

and find it in my email:

Array ()

I think that 'I'm correct with an array I am not working from, but maybe I am missing something in all this. I hope to get back the actual XML string

You are not sending anything except data, so PHP has some important and valuable data as could not explain why, you need to send the value of the variable:

  curl_setopt ($ ch, CURLOPT_POSTFIELDS, array ( 'xml_data' = & gt; $ xml_data ));   

Or receive as a raw post data:

     

Comments