<?php
$url = "http://site.com";
$sourcepage = "$url/xx.php";
$tempfilename = "tmp_xx.html";
$targetfilename = "yourpath/xx.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>";
?>