PHP Receiving XML

Nptpqzuw

New Member
I have a small PHP script that is listening for a POST request. I'm expecting xml, always.Normally I'm the guy sending the xml requests. But today I'm on the receiving side.I figured it would be a simple case of listening for a $_POST, but I guess I may be incorrect - I'm getting nothing.Here's my script that waits for anything xml:\[code\]<?phpif(isset($_POST)) { mail("[email protected]","some title i want", print_r($_POST, true)); }else{ die("uh, what happened?");}?>\[/code\]And here is a simple xml string I'm sending from another place:\[code\]<?php$xml_data ='http://stackoverflow.com/questions/11405379/<note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don/'t forget me this weekend!</body></note>';function sendXML2Server($URL,$XML){ $xml_data = http://stackoverflow.com/questions/11405379/trim($XML); $ch = curl_init($URL); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml')); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); return $output;}echo sendXML2Server('https://someurl.com/inboundxml.php',$xml_data)?>\[/code\]And here's what I get in my email:Array()I'm guessing I'm not working with an array correctly, but maybe there's something else I'm missing in all this. I'm expecting to get back the actual xml string.
 
Back
Top