在AS3 Flash中编辑和保存XML

I have difficulty with this since this morning, so I finally decided to ask for your help.. I've tried many solutions but none works as I want. I want to load a XML file (local) and edit it and then save the results in the same file. The loading/reading isn't an issue, it works fine, but to save the file is very hard in as3.

(nb: I have an local serveur, so this isn't the problem)

Here's my best approach of the problem so far (found here):

save.php :

<?php
if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){ 
    $xml = $GLOBALS["HTTP_RAW_POST_DATA"]; 
    $file = fopen("http://localhost/cs_texte.xml","wt"); 
    fwrite($file, $xml); 
    fclose($file);
} 
?>

myAs3script.as :

var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

// Loading XML -> works fine     
xmlLoader.load(new URLRequest("http://localhost/cs_texte.xml"));

//When loading complete          
function LoadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    trace(xmlData); // Works fine 

    [.. Do some stuff on xml ..]

    var xmlResponse:XML;
    var xmlURLReq:URLRequest = new URLRequest("http://localhost/save.php");
    xmlURLReq.data = xmlData;
    xmlURLReq.contentType = "text/xml";
    xmlURLReq.method = URLRequestMethod.POST;
    var xmlSendLoad:URLLoader = new URLLoader();
    xmlSendLoad.addEventListener(Event.COMPLETE, completeHandler);
    xmlSendLoad.load(xmlURLReq);

    function completeHandler(evt:Event) {
        trace ('Save complete');
    }           
}

But it's not working, the xml file doesn't change at all, even if I try to empty it..

Any idea why ? (And do you know how to get php error in flash output console ? if there is any..)

Thansk for your help ! (And please be indulgent, this isn't my project initially..)

Thanks to Andrey Popov I figured out the problem, it was just a problem of absolute url instead of a relative url.. So you need to give a relative address from your PHP file like that :

<?php
if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){ 
    $xml = $GLOBALS["HTTP_RAW_POST_DATA"]; 
    $file = fopen("cs_texte.xml","wt"); 
    fwrite($file, $xml); 
    fclose($file);
} 
?>

It was just that, but it gives me really hard time ! Thanks to help me figured out, hope that would help someone !