rline101 Posted March 15, 2007 Share Posted March 15, 2007 I have a file (say, output.php) which produces information which is output to a browser at present. That's good. But I need the exact browser ouptut to be turned into a text file (say, output.txt) which will be automatically saved somewhere on my disk, whenever output.php is run. How can I make this happen? Thankyou. Link to comment https://forums.phpfreaks.com/topic/42918-solved-write-broswer-output-to-new-file/ Share on other sites More sharing options...
per1os Posted March 15, 2007 Share Posted March 15, 2007 <?php ob_start(); echo "This is outputted to the browser YAY!"; $browserOutput = ob_get_contents(); ob_end_clean(); $fp = fopen("filename.txt", "w+"); // note look at fopen in php.net to determine what you need here fwrite($fp, $browserOutput); fclose($fp); print $browserOutput; // if you want to show that to the browser ?> Link to comment https://forums.phpfreaks.com/topic/42918-solved-write-broswer-output-to-new-file/#findComment-208487 Share on other sites More sharing options...
rline101 Posted March 16, 2007 Author Share Posted March 16, 2007 frost110. Thanks so much. This did it. Excellent! Link to comment https://forums.phpfreaks.com/topic/42918-solved-write-broswer-output-to-new-file/#findComment-208554 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.