Writing XML with PHP
Posted: Wed Mar 07, 2007 12:30 pm
I as trying to write this XML using this code. The XML data comes from FLEX and is sent to the PHP code. The code writes to the file fine, but around the entire xml that was sent from flex, there are additional < /> around all of the data which caused my xml document to be in error. I'm pretty sure it's the add-root function in there but I don't know alot about PHP and have no idea on what to change it to.
Thanks in advance!!
Code: Select all
<?
$doc = new_xmldoc('1.0');
$XMLData = stripSlashes($XMLData);
$root = $doc->add_root($XMLData);
$fp = @fopen($path,'w');
if(!$fp) {
die('Error cannot create XML file');
}
fwrite($fp,$doc->dumpmem());
fclose($fp);
?>