# sendAndLoad to xml via php (modify an xml from flash)

**URL:** <https://forum.kirupa.com/t/sendandload-to-xml-via-php-modify-an-xml-from-flash/159365>\
**Category:** flash\
**Created:** [August 17, 2005, 12:12am UTC](https://forum.kirupa.com/t/sendandload-to-xml-via-php-modify-an-xml-from-flash/159365 "2005-08-17T00:12:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tabarnaco](https://avatars.discourse-cdn.com/v4/letter/t/58f4c7/32.png) [@tabarnaco](https://forum.kirupa.com/u/tabarnaco)\
**Post date:** [August 17, 2005, 12:12am UTC](https://forum.kirupa.com/t/sendandload-to-xml-via-php-modify-an-xml-from-flash/159365/1 "2005-08-17T00:12:12Z")

</div>

Here what I want to do:  
I want to modify an existing xml file (membres.xml) starting from flash by using sendAndLoad() and while passing by a php file. I control rather well flash, I know xml better and better but I know the php still little. My progamming is partly inspired from this tutorial:  
[http://www.kirupa.com/web/xml/examples/simpleeditor.htm](http://www.kirupa.com/web/xml/examples/simpleeditor.htm)  
But something still does not function… This is why I need your assistance. All seems to function, but my xml file (membres.xml) remains unchanged.

Flash:  
In flash, after having loaded and having modified the file membres.xml, I use sendAndLoad to send my xml object to the php file:

reload\_xml.sendAndLoad(“envoiexml.php”, membres\_xml);

a trace of the xml object did right before sendAndLoad shows that the xml object reload\_xml was modified correctly. The error must thus logically be further

PHP:  
Here now the php code in the file envoiexml.php:

\<?php  
$filename = “membres.xml”;  
$raw\_xml = file\_get\_contents(“php://input”);

print $raw\_xml;

$fp = fopen($filename, “w”);  
fwrite($fp, $raw\_xml);  
fclose($fp);  
?\>

I only know a little in php. It is an integral copied/pasted script provided in the tutorial mentioned above. I did nothing but change the name of the xml file… But when then I check the xml document, it is always empty:

\< membres \>\</membres \>

Your assistance would be strongly appreciated! Thank you in advance! :thumb:
