Redirecting output to a file

From: Date: Wed, 17 Jan 2001 12:07:25 +0000
Subject: Redirecting output to a file
Groups: php.dev 
Request: Send a blank email to php-dev+get-44353@lists.php.net to get a copy of this message
Please correct me if there is already a facility to do this in place, but I have searched the manual and can find no functions. I would like the ability to redirect the standard PHP output stream to a file temporarily to a file, and return to output to the browser at some point in the script. Here is an example of the kind of thing I mean: <? $fd = fopen("/tmp/foo.html","w"); redirect_output($fd); print "This goes to the file"; ?> So does this <? restore_output(); print "This goes to the browser"; ?> I have started to look at the source and seen that most of what I need seems to be going on in php_output_globals int ext/standard/php_output.h. I am willing to write the extension to give me this functionality, but before I start coding in earnist I would appreciate any pointers or warnings of problems that may be involved. Many thanks, Malcolm Locke

« previous php.dev (#44353) next »