zakmail007
05-25-2011, 06:39 AM
I want to save xml data in a separate file of .xml using cake php. i used the following code:
$a="test";
$b="test1";
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
$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 my code or please give me a new code i'm using cake php.
$a="test";
$b="test1";
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
$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 my code or please give me a new code i'm using cake php.