For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > November 2004 > sending php output to a file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author sending php output to a file
chris

2004-11-29, 3:59 pm

what i want to do is as well as displaying a php generated page on the users
browser i want the same page to be put into a new html file .

or even just send the output directly to a file rather than the browser.

any pointers would be great.


Janwillem Borleffs

2004-11-29, 3:59 pm

chris wrote:
> what i want to do is as well as displaying a php generated page on
> the users browser i want the same page to be put into a new html file
> .
> or even just send the output directly to a file rather than the
> browser.
> any pointers would be great.


Have a look at the output control functions:

http://www.php.net/manual/en/ref.outcontrol.php


JW



chris

2004-11-29, 3:59 pm

thanks for that
but how do i tell it to output the info to a file rather than the browser?



"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:41a9959b$0$76506$b83b6cc0@news.euronet.nl...
> chris wrote:
>
> Have a look at the output control functions:
>
> http://www.php.net/manual/en/ref.outcontrol.php
>
>
> JW
>
>
>



Janwillem Borleffs

2004-11-29, 3:59 pm

chris wrote:
> thanks for that
> but how do i tell it to output the info to a file rather than the
> browser?


<?php

ob_start();

// Do your stuff

// Store the contents in a variable which
// you can store in a file
$contents = ob_get_contents();

// Display content
ob_end_flush();

?>


JW



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com