# Flash to PHP to XML problems

**URL:** https://forum.kirupa.com/t/flash-to-php-to-xml-problems/266063
**Category:** flash
**Created:** [July 15, 2008, 10:12pm UTC](https://forum.kirupa.com/t/flash-to-php-to-xml-problems/266063 "2008-07-15T22:12:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Holmesc](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@Holmesc](https://forum.kirupa.com/u/Holmesc)
#### Post date: [July 15, 2008, 10:12pm UTC](https://forum.kirupa.com/t/flash-to-php-to-xml-problems/266063/1 "2008-07-15T22:12:16Z")

</div>

I’m currently working on a project in which, by using a Flash file, a user can store and load messages in/from an XML file. To accomplish this, I tried to use the example in kirupa’s Introduction to XML ([http://www.kirupa.com/web/xml/examples/simpleeditor.htm](http://www.kirupa.com/web/xml/examples/simpleeditor.htm)). However, I can’t get it to work in my file, the example on the page, or the downloaded example. I don’t have any knowledge of PHP, so I don’t know whether the problem is the Flash file not sending it correctly or the PHP file not receiving/writing it. If this question would be better asked in the Server-Side forum, I will repost it there/be grateful to whomever moves it.

Anyways, here’s what everything I have looks like.

File Structure:  
-main folder  
–flash\_file.html \<-- HTML file, as instructed in tutorial  
–send.php  
–data.xml

Actionscript:

```auto

stop();
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.contentType = "text/xml";
xmlData.onLoad = loadXML;
xmlData.load("data.xml");
input_xml = new XML();
input_xml.ignoreWhite = true;
input_xml.contentType = "text/xml";
submit_btn.onRelease = function() {
    currentDate = new Date();
    day = currentDate.getDate();
    month = currentDate.getMonth();
    year = currentDate.getFullYear();
    xmlNode = xmlData.firstChild;
    input_xml = xmlNode+"<event><date><day>"+day+"</day><month>"+[month+1]+"</month><year>"+year+"</year></date><msg>"+input_txt+"</msg></event>";
    input_xml.sendAndLoad("send.php",output_xml);
    input_txt = "Loading";
};
clear_btn.onRelease = function() {
    input_txt = "";
};
back_btn.onRelease = function() {
    gotoAndStop(1);
};

```

PHP File (as seen in the tutorial):

```php

<?php
$filename = "data.xml";
$raw_xml = file_get_contents("php://input");
 
print $raw_xml;
 
$fp = fopen($filename, "w");
fwrite($fp, $raw_xml);
fclose($fp);
?>

```

XML File (an example):

```auto

<?xml version="1.0" ?>
<calendar>
    <event>
        <date>
            <day>15</day>
            <month>9</month>
            <year>2008</year>
        </date>
        <msg>Hello world.</msg>
    </event>
</calendar>

```

Sooo, there you go. I don’t think there’s anything else important I’m leaving out, but if there is, do tell and I will post it as soon as possible. Thanks for your help!
