Need to write a html output in a file
Posted: Thu Aug 20, 2009 5:23 am
Hi all,
I need to write a html output to the text file.
For ex.
<?php
$str = "<html><body><table><tr><td>fjlhfg</td><td>dsdsdf</td></tr></table></body></html>";
$myFile = "report.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
echo $str;
fwrite($fh, $str);
fclose($fh);
?>
Here the out put of the report.txt is "<html><body><table><tr><td>fjlhfg</td><td>dsdsdf</td></tr></table></body></html>"
But while we run this in browser it shows like "fjlhfg dsdsdf"
I need to write the browser output to a file (as like fjlhfg dsdsdf)..
Any idea's welcome....
Thanks..
I need to write a html output to the text file.
For ex.
<?php
$str = "<html><body><table><tr><td>fjlhfg</td><td>dsdsdf</td></tr></table></body></html>";
$myFile = "report.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
echo $str;
fwrite($fh, $str);
fclose($fh);
?>
Here the out put of the report.txt is "<html><body><table><tr><td>fjlhfg</td><td>dsdsdf</td></tr></table></body></html>"
But while we run this in browser it shows like "fjlhfg dsdsdf"
I need to write the browser output to a file (as like fjlhfg dsdsdf)..
Any idea's welcome....
Thanks..