Hey there, I am experimenting sending XML from Flash to a PHP page that should then write to a txt file and I can’t get this to work, the txt file remains empty and I am not getting a response from the traceMe() function that displays the status. The archive.zip contains the php fla and txt.
Can anyone help?
Here’s my code:
PHP:
<?php
$filename = "xmloutput.txt";
$fp = fopen( $filename,"w+");
fwrite ( $fp, "$HTTP_RAW_POST_DATA" );
fclose( $fp );
print '<?xml version="1.0"?><result>LOGIN OK</result>';
?>
Actionscript:
//A setting up the xml object to send
var loginXML = new XML();
loginElement = loginXML.createElement("LOGIN");
loginElement.attributes.username = "hectors";
loginElement.attributes.password = "itsmysecret";
loginXML.appendChild(loginElement);
// B. Construct a XML object to hold the server's reply
loginReplyXML = new XML();
loginReplyXML.onLoad = onLoginReply;
function onLoginReply(success:Boolean):Void {
if (success) {
traceMe("loginReply receieved")
} else {
traceMe("loginReply did not load")
}
}
// C. Send the LOGIN element to the server,
//place the reply in loginReplyXML
loginXML.sendAndLoad("xmlreader.php", loginReplyXML);
Thanks everyone,
Hectors