What approach could someone suggest to save the current page as an HTML file to the server? In this case, also note that security is not an issue.
I
I think we can use Output Control Functions of PHP, you can use save the content to the variable first and then save them to the new file, next time, you can test it the html file exists, then render that else re-generate the page.
time()) )
{
$content = file_get_contents($cacheFile);
echo $content;
} else
{
ob_start();
// write content
echo 'Hello world to cache
';
$content = ob_get_contents();
ob_end_clean();
file_put_contents($cacheFile,$content);
echo $content;
}
?>
Example taken from : http://www.php.net/manual/en/function.ob-start.php#88212