I have a site that's pulling a multifeed which is being copied to a static HTML page using the copy() function. I also have a cron job that's set to automate this process and continually deliver updated feeds.
My problem is that while the multifeed works well sometimes the html delivers a blank page - no navigation, no errors, no nothing....
Heres the code I'm using;
PHP Code:
$url = "[site destination]"; //$sourcepage = "$url/php/express.php"; $sourcepage = "$url/php/mm/index.php"; $tempfilename = "/tmp/tmp_express.html"; $targetfilename = "[index_file_path]/html/express.html";
$dynamic_source = fopen($sourcepage, 'r');
if (!$dynamic_source) { echo "<strong>Unable to load $sourcepage - Static page! Update Failed!</strong>"; exit(); } $htmldata = file_get_contents($sourcepage); 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>Express RSS Feeds Updated!</strong>";
Any ideas on why this is happening or what I could to circumvent it would be much appreciated.
|