Page 1 of 1

save generated page as htm on server

Posted: Fri Jun 11, 2010 9:24 am
by janper
hello
is it possible to save the html generated using php on server for further use? it takes about 10 seconds to generate my website using php and the result is generally allways the same until i don't upload something on the server. so it would be enough to generate the output let's say once a day an for the rest of the day use the static generated html.
i can imagine writing everything into a single string or so, but the site is already done and quite complex. i don't think i could now simply rewrite completely without forgetting something, so i'd like to use the already generated output.
maybe if it was possible to redirect the outuput into a file instead of the client browser?

thanks!

ps: the website is www.janper.sk

Re: save generated page as htm on server

Posted: Fri Jun 11, 2010 3:12 pm
by lunarnet76
hi,

You should be able to use

Code: Select all

// check if the output exists in cache
if(true){
// read the output
exit;
}
ob_start();
at the begining of your script then

Code: Select all

$content=ob_get_content();
// write content to a specific file name

Re: save generated page as htm on server

Posted: Sat Jun 12, 2010 3:51 am
by janper
thanks! it works ;)