Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.php > #3219

Re: A way to redirect standard output (Simply?)

Newsgroups alt.php
Date 2019-10-16 10:12 -0700
References <MrJB6.547$ep.378867@news1.rdc1.tn.home.com> <xvKB6.1134$Jh5.650173@news1.rdc1.sfba.home.com>
Message-ID <69ab014e-2a45-4c72-902c-d6e70e21dc91@googlegroups.com> (permalink)
Subject Re: A way to redirect standard output (Simply?)
From daniel.tate@gmail.com

Show all headers | View raw


On Friday, April 13, 2001 at 4:49:17 PM UTC-5, J Lillge wrote:
> >
>       > In perl, you can use the select() operator to make
>       > all your output go to a file.  Is there something
>       > similar in php4?   I have a program with hundreds of
>       > print() statements.  I want to be able to save the
>       > output to a file simultaniously.  Suggestions?
>       >
> 
> 
> I think the following should work (in PHP4 only):
> 
> 
> ================================
>       <?
>         // INSERT THIS BLOCK AT THE TOP OF THE FILE
>         ob_start();
>       ?>
> 
>       <html><body><? print("Hello!") ?></body></html>
> 
>       <?
>         // INSERT THIS BLOCK AT THE BOTTOM OF THE FILE
>         $filename = "whatever.html";
>         $fp = fopen($filename, "w");
>         $out = ob_get_contents();
>         fwrite($fp, $out, strlen($out));
>         fclose($fp);
>         ob_end_clean();
>       ?>
> ================================
> 
> 
> JL

thanks

Back to alt.php | Previous | NextNext in thread | Find similar


Thread

Re: A way to redirect standard output (Simply?) daniel.tate@gmail.com - 2019-10-16 10:12 -0700
  Re: A way to redirect standard output (Simply?) Jerry Stuckle <jstucklex@attglobal.net> - 2019-10-16 23:48 -0400

csiph-web