Re: Redirecting HTML output to FILE

From: Date: Thu, 02 May 2002 06:07:09 +0000
Subject: Re: Redirecting HTML output to FILE
References: 1  Groups: php.lang 
Request: Send a blank email to php-lang+get-298@lists.php.net to get a copy of this message
In addition, you may do something like this: <?php //Write output buffer to file. function callback($buffer) { $file = __FILE__ . '.static'; $head = '<!-- Contents of "' . $GLOBALS['PHP_SELF'] . '" -->' . "\n"; $head .= '<!-- Updated: ' . date("m/d/y @ H:i:s T") . ' -->' . "\n"; $fp = fopen($file, 'w'); fwrite($fp, $head); fwrite($fp, $buffer); fclose($fp); return $buffer; } //Start buffering and call "callback" function when flushed. ob_start('callback'); ?> <HTML> <HEAD><TITLE>Buffer Test</TITLE></HEAD> <BODY> <? /* (this comment will dissapear) */ ?> <P ALIGN="CENTER">This is a Test</P> <P ALIGN="CENTER"><? echo date("D M j G:i:s T Y"); ?></P> </BODY> </HTML> <?php //Flush buffer. ob_end_flush(); ?> -- Erik Paul Padilla wrote: > > How would one go about redirecting the result of an HTML page to a file > in the webserver instead of the client's browser? I am trying to parse > out information from an HTML result page using PHP but don't know which > PHP syntax to use to redirect the HTML result into a file. > > Cheers, > Paul

« previous php.lang (#298) next »