Re: Generating a Static HTML Page from PHP

From: Date: Mon, 19 May 2003 23:15:20 +0000
Subject: Re: Generating a Static HTML Page from PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148229@lists.php.net to get a copy of this message
On Mon, 19 May 2003 15:51:40 -0700, you wrote: >Is there a PHP function or some way to cause the HTML output from a PHP >page to be sent directly to a file instead of the client (browser)? > >What I would like to do is use a PHP CLI and invoke this PHP script to >generate a HTML page that can be served statically by the web server. There are other ways to do this, but.. From the command line scriptname.php > filename.html will dump the output of a script to a file. From within a script the output control functions allow you access to the script's output http://www.php.net/manual/en/ref.outcontrol.php Use ob_start() to turn on output buffering, and once your script has finished producing output ob_get_contents() can be used to grab the result, which you can then do whatever you want with.

« previous php.general (#148229) next »