I want to save this xml data in a separate .xml file in cakePHP but its not working. I used following code:
$a="test";
$b="mytest";
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
$xml.= "<registrations>";
$xml.= " <registration>";
$xml.= " <id>".$a."</id>";
$xml.= " <name>".$b."</name>";
$xml.= " </registration>";
$xml.= "</registrations>";
$fh = fopen('my_xmls.xml', 'w+');
fwrite($fh, $xml);
fclose($fh);
what is the problem in this code or please give me a new code.
Does the actual code include the opening <?php tag?
You may want to ensure all error reporting is on, or check the PHP error log to see if there are file write permission errors or such.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks