I used this tutorial http://www.phpfreaks.com/tutorials/29/1.php, but it doesn't work.
I want to get a page with NO php on it, ONLY HTML.. but the code doesn't work (the OUTPUT file has ALSO PHP ON IT). Here is the code... what's wrong?
<?php
$url = "http://www.mysite.com";
$sourcepage = "$url/static_generator/tutorial_index.php";
$tempfilename = "/tmp/temp_tutorials.html";
$targetfilename = "/www/htdocs/mysite/static_html/tutorial_index.html";
$dynamic_source = fopen($sourcepage, 'r');
if (!$dynamic_source) {
echo "<strong>Unable to load $sourcepage
- Static page! Update Failed!</strong>";
exit();
}
$htmldata = fread($dynamic_source, 1024*1024);
fclose($dynamic_source);
$tempfile = fopen($tempfilename, 'w');
if (!$tempfile) {
echo"<strong>Unable to open temporary file $tempfilename for writing!
Static page update aborted!</strong>";
exit();
}
fwrite($tempfile, $htmldata);
fclose($tempfile);
copy($tempfilename, $targetfilename);
unlink($tempfilename);
echo "<strong>Tutorial Index Updated!</strong>";
?>