Re: get output in .html file
| From: | Shawn McKenzie | Date: | Thu, 18 Dec 2003 06:14:58 +0000 |
| Subject: | Re: get output in .html file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172926@lists.php.net to get a copy of this message | ||
Buffer output and then write it to a file. I do it all the time.
ob_start();
//output some stuff here
$content = ob_get_contents();
ob_end_flush();
if ($handle = fopen("yourfile.html", "w")) {
fwrite($handle, $content);
fclose($handle);
}
-Shawn
"Martin" <maus@wanadoo.fr> wrote in message
news:20031218031849.73819.qmail@pb1.pair.com...
> Does somebody know how to get the output of an .php file into an .html
file
> (server side). This in order to cache generated pages for futur visitors.
>
> thanks
>
> Martin