AW: [PHP] Output HTML to a file
| From: | Sebastian Stadtlich | Date: | Wed, 22 Nov 2000 16:39:30 +0000 |
| Subject: | AW: [PHP] Output HTML to a file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26661@lists.php.net to get a copy of this message | ||
if you use php4 then use output buffering....
ob_start();
ob_implicit_flush(0);
echo 'foobar';
$inhalt = ob_get_contents();
$Cachedatei='test.htm';
$datei=fopen($Cachedatei, "w");
fwrite($datei, $inhalt);
fclose($datei);
ob_end_flush();
on php3 the best approach i have ever seen is:
$selbst = fopen('www.foobar.com', "r");
$inhalt = fread($selbst,1000000);
fclose($selbst);
have fun
Sebastian
> -----Ursprüngliche Nachricht-----
> Von: Kevin Rose [mailto:krose@bluebonnet.net]
> Gesendet am: Mittwoch, 22. November 2000 17:07
> An: php-general@lists.php.net
> Betreff: [PHP] Output HTML to a file
>
> Hello list,
>
> I need to capture, into a file, the HTML generated via my PHP.
>
> I just wanted to verify there was not an easy solution that
> would allow me
> to redirect my output to a file (since I have the PHP page
> generating the
> HTML and currently displaying to the browser).
>
> I have read the list about the setting everything into a string, then
> fwriting the string.
>
> Just wanted to check before I go to the trouble of modifying
> every line in
> my PHP page.
>
> Thanks a head of time,
> Kevin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>