Discussion:
A way to redirect standard output (Simply?)
(too old to reply)
d***@gmail.com
2019-10-16 17:12:12 UTC
Permalink
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?
================================
<?
// 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
Jerry Stuckle
2019-10-17 03:48:44 UTC
Permalink
Post by d***@gmail.com
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?
================================
<?
// 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
The post you're responding to is over 18 years old. I think the OP has
probably found the solution by now.
--
==================
Remove the "x" from my email address
Jerry Stuckle
***@attglobal.net
==================
Loading...