Sending data from Flash via PHP to XML

Hello,

This is a slight adaption from code given in ‘A beginners guide to AS3’ that is meant to work, although for the life of me I can’t get it to work, both on my server and locally (using XAMPP).

 
[COLOR=#993300]var[/COLOR] respTxt:[COLOR=#993300]TextField[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]TextField[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#993300]var[/COLOR] myTextFormat:[COLOR=#993300]TextFormat[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]TextFormat[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];myTextFormat.[COLOR=#993300]size[/COLOR] = [COLOR=#000000]14[/COLOR];

[COLOR=#993300]var[/COLOR] xmlString:[COLOR=#993300]String[/COLOR] = [COLOR=#0000ff]"<?xml version='1.0' encoding='ISO-8859-1'?><root><value>63</value></root>"[/COLOR];
[COLOR=#993300]var[/COLOR] book:[COLOR=#993300]XML[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]XML[/COLOR][COLOR=#000000]([/COLOR]xmlString[COLOR=#000000])[/COLOR];

[COLOR=#993300]var[/COLOR] xmlResponse:[COLOR=#993300]XML[/COLOR];

[COLOR=#993300]var[/COLOR] xmlURLReq:URLRequest = [COLOR=#993300]new[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#0000ff]"savexml.php"[/COLOR][COLOR=#000000])[/COLOR];
xmlURLReq.[COLOR=#993300]data[/COLOR] = book;
xmlURLReq.[COLOR=#993300]contentType[/COLOR] = [COLOR=#0000ff]"text/xml"[/COLOR];
xmlURLReq.[COLOR=#000000]method[/COLOR] = URLRequestMethod.[COLOR=#000000]POST[/COLOR];

[COLOR=#993300]var[/COLOR] xmlSendLoad:URLLoader = [COLOR=#993300]new[/COLOR] URLLoader[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
xmlSendLoad.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000000]COMPLETE[/COLOR], onComplete, [COLOR=#993300]false[/COLOR], [COLOR=#000000]0[/COLOR], [COLOR=#993300]true[/COLOR][COLOR=#000000])[/COLOR];
xmlSendLoad.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]IOErrorEvent.[COLOR=#000000]IO_ERROR[/COLOR], onIOError, [COLOR=#993300]false[/COLOR], [COLOR=#000000]0[/COLOR], [COLOR=#993300]true[/COLOR][COLOR=#000000])[/COLOR];
xmlSendLoad.[COLOR=#993300]load[/COLOR][COLOR=#000000]([/COLOR]xmlURLReq[COLOR=#000000])[/COLOR];

[COLOR=#993300]function[/COLOR] onComplete[COLOR=#000000]([/COLOR]evt:Event[COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#993300]try[/COLOR] [COLOR=#000000]{[/COLOR]
        xmlResponse = [COLOR=#993300]new[/COLOR] [COLOR=#993300]XML[/COLOR][COLOR=#000000]([/COLOR]evt.[COLOR=#993300]target[/COLOR].[COLOR=#993300]data[/COLOR][COLOR=#000000])[/COLOR];
        respTxt.[COLOR=#993300]text[/COLOR] = xmlResponse;
        removeEventListener[COLOR=#000000]([/COLOR]Event.[COLOR=#000000]COMPLETE[/COLOR], onComplete[COLOR=#000000])[/COLOR];
        removeEventListener[COLOR=#000000]([/COLOR]IOErrorEvent.[COLOR=#000000]IO_ERROR[/COLOR], onIOError[COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR] [COLOR=#993300]catch[/COLOR] [COLOR=#000000]([/COLOR]err:TypeError[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
        respTxt.[COLOR=#993300]text[/COLOR] = [COLOR=#0000ff]"An error occured when communicating with server:[COLOR=#000099]**
**[/COLOR]"[/COLOR] + err.[COLOR=#993300]message[/COLOR];
    [COLOR=#000000]}[/COLOR]
    placeText[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]function[/COLOR] onIOError[COLOR=#000000]([/COLOR]evt:IOErrorEvent[COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR] [COLOR=#000000]{[/COLOR]
    respTxt.[COLOR=#993300]text[/COLOR] = [COLOR=#0000ff]"An error occurred when attempting to load the XML.[COLOR=#000099]**
**[/COLOR]"[/COLOR] + evt.[COLOR=#993300]text[/COLOR];
    placeText[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]function[/COLOR] placeText[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR] [COLOR=#000000]{[/COLOR]
    respTxt.[COLOR=#000000]x[/COLOR] = [COLOR=#000000]15[/COLOR];
    respTxt.[COLOR=#000000]y[/COLOR] = [COLOR=#000000]15[/COLOR];
    respTxt.[COLOR=#993300]multiline[/COLOR] = [COLOR=#993300]true[/COLOR];
    respTxt.[COLOR=#993300]autoSize[/COLOR] = TextFieldAutoSize.[COLOR=#993300]LEFT[/COLOR];
    respTxt.[COLOR=#993300]setTextFormat[/COLOR][COLOR=#000000]([/COLOR]myTextFormat[COLOR=#000000])[/COLOR];
    addChild[COLOR=#000000]([/COLOR]respTxt[COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]

And the PHP

<?php 
if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){ 
//    $xml = xmldoc($GLOBALS["HTTP_RAW_POST_DATA"]); 
    $xml = $GLOBALS["HTTP_RAW_POST_DATA"]; 
    $file = fopen("data.xml","wb"); 
    fwrite($file, $xml); 
    fclose($file); 
//    echo("<status>File saved.</status>"); 
    echo($GLOBALS["HTTP_RAW_POST_DATA"]); 
} 
?> 

Locally I get a blank text box, nothing shows up. On my server, I get:

An error occurred when attempting to load the XML.
Error #2032

Could anyone shed some light on this? Or maybe test this out for themselves and see if it is just me!

Thanks,

Richard