heres my code:
##################################
#CACHE THE FILE FROM THE SERVER
##################################
$cache_time = 300; //time in seconds
$myfile = "feed.htm";
$modified = @filemtime($myfile);
$now = strtotime("now");
$difference = $now - $modified;
if ($difference >= $cache_time)
{
echo "File Cached<br/><br/>";
$fh = fopen($myfile, 'w') or die("<ul><li>File Error</li></ul>");
$link = "---private url---";
$string = file_get_contents($link) or die("<ul><li>Feed Unavailable</li></ul>");
fwrite($fh, $string) or die("<ul><li>File Error</li></ul>");
fclose($fh);
}
$html = file_get_contents($myfile,"r") or die("<ul><li>Feed Unavailable</li></ul>");
Now, when the feed isnt cached (by that i mean it skips the caching loop), everything works perfect... my whole script runs perfect... now when the file caches, i get an error:
Fatal error: [] operator not supported for strings
later in my code, but when i refresh, it works perfectly again... what the hell could be going wrong in the cache loop that would futz things up like that?