# XML, PHP, Flash and no hair!

**URL:** <https://forum.kirupa.com/t/xml-php-flash-and-no-hair/152800>\
**Category:** programming\
**Created:** [June 27, 2005, 2:28pm UTC](https://forum.kirupa.com/t/xml-php-flash-and-no-hair/152800 "2005-06-27T14:28:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TjomasC](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@TjomasC](https://forum.kirupa.com/u/TjomasC)\
**Post date:** [June 27, 2005, 2:28pm UTC](https://forum.kirupa.com/t/xml-php-flash-and-no-hair/152800/1 "2005-06-27T14:28:58Z")

</div>

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):

```auto
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
<?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!
