Problem with output
Posted: Fri Sep 26, 2003 6:50 pm
I am trying to write xml content to a newly create file call test.xml.
The following is part of the script i use.
However, everytime i run this script, a file (text.xml) is created but it is empty! the XML is then output to the browser. Can anyone please indicate to me how best to tackle this bug of mine! Thanks
The following is part of the script i use.
Code: Select all
<?php
header('Content-Type: text/xml');
header("Content-Disposition: filename=$filename");
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
//echo more xml
$filename = 'test.xml';
fopen($filename,'x+');
//$thefile is the xml string
fwrite($filename,$thefile);
fclose($filename);
?>