Anything wrong with this php code?
- by Hwang
1st I have to say I know nothing bout php. I was actually doing my AS3 guest-book and through parts of tutorials from Activetut, I managed to come out a flash guest-book. So the problem now I'm facing is the guest-book could only inject 1 XML data and it will always clear off the old 1, while the flash is still caching on the old XML files.
I'd found some other tutorials(which I think its quite hard since i dunno anything about php) and comparing to the php code I'm using, it seems to be extremely short. I have no idea what the code does, so currently I'm not sure whether the problems came from the php or my AS3.
<?php
if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){
$xml = $GLOBALS["HTTP_RAW_POST_DATA"];
$file = fopen("wish.xml","wb");
fwrite($file, $xml);
fclose($file);
}
?>
and below is my correct XML format:
<WISHES>
<WISH>
<NAME>Test</NAME>
<EMAIL>[email protected]</EMAIL>
<DATENTIME>2/3/10</DATENTIME>
<MESSAGE>Dummy Message</MESSAGE>
</WISH>
<WISH>
<NAME>Test</NAME>
<EMAIL>[email protected]</EMAIL>
<DATENTIME>2/3/10</DATENTIME>
<MESSAGE>Dummy Message</MESSAGE>
</WISH>
</WISHES>
So anyone kind to explain what that php code does? cause it replace my XML with:
<WISH>
<NAME>Test</NAME>
<EMAIL>[email protected]</EMAIL>
<DATENTIME>2/3/10</DATENTIME>
<MESSAGE>Dummy Message</MESSAGE>
</WISH>