blu3
09-27-2007, 03:55 PM
I have an XML object i need to send from Flex to php so that php can write it to a file. I am trying to send it using HTTPService:
<mx:HTTPService id="sendXML" url="http://localhost/php/getXML.php" contentType="application/xml" useProxy="false" method="POST">
</mx:HTTPService>
And my getXML.php looks like this:
<?php
$raw_xml = file_get_contents("php://input");
$myFile = "testFile.xml";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $raw_xml);
fclose($fh);
?>
After i do :
sendXML.request = inputXML; //inputXML is my XML object
sendXML.send();
I get the empty 'testFile.xml' file so i am obviously doing something wrong but can't figure it out what excatly :confused: Can someone please help me with this?
thanks in advance
<mx:HTTPService id="sendXML" url="http://localhost/php/getXML.php" contentType="application/xml" useProxy="false" method="POST">
</mx:HTTPService>
And my getXML.php looks like this:
<?php
$raw_xml = file_get_contents("php://input");
$myFile = "testFile.xml";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $raw_xml);
fclose($fh);
?>
After i do :
sendXML.request = inputXML; //inputXML is my XML object
sendXML.send();
I get the empty 'testFile.xml' file so i am obviously doing something wrong but can't figure it out what excatly :confused: Can someone please help me with this?
thanks in advance