Can anyone help me with this problem, its being causing me grief for the best part of a day!
I’m trying to send XML from flash using the xml.send() method, and a PHP file. The problem is, after searching through about 10 tutorials, it still doesn’t work!
Can anyone see any problems with it, or suggest an answer?
Here’s the Actionscript (1.0):
xmlfile = _global.usrfile;
charsave = new XML();
charsave.load("/game/usr/"+xmlfile+".xml");
charsave.ignoreWhite = true;
charsave.contentType = "text/xml";
charsave.onLoad = function(success) {
if (success) {
root = charsave.firstChild;
charinfo = root.firstChild;
charname = charinfo.childnodes[0];
chardesign = charinfo.childnodes[1];
trace(root);
trace(charinfo);
trace(chardesign);
// now to add the stuff!!
xmlname = charname.attributes.NAME=name;
xmlhairtype = chardesign.attributes.HAIRTYPE=hairtype;
xmlhaircolour = chardesign.attributes.HAIRCOLOUR=haircolour;
xmlgender = chardesign.attributes.GENDER=gender;
xmlhat = chardesign.attributes.HAT=htchce;
xmlclothescolour = chardesign.attributes.CLOTHESCOLOUR=clothescolour;
xmlshirttype = chardesign.attributes.SHIRTTYPE=shirttype;
xmlskincolour = chardesign.attributes.SKINCOLOUR=skincolour;
loading = "loaded";
charsave.send("/game/modules/charbuilder_send.php");
trace(chardesign);
trace(charname);
} else {
loading = "error";
}
};
and the PHP file:
<?php
print "1.4.1";
$raw_xml = file_get_contents("php://input");
//$raw_xml = $GLOBALS['HTTP_RAW_POST_DATA'];
print $raw_xml;
$usrfile = $_POST['xmlfile'];
$filename = "/game/usr/".$xmlfile.".xml";
print $filename;
$fp = fopen($filename);
fwrite($fp, $raw_xml);
fclose($fp);
print "Done saving";
?>
everything is CHMODed to 777, so that can’t be the problem!