Hi,
I've got a simple dealy-bob that opens a remote file, and writes it to a local file.php include. What is the recommended best way to not have the contents of the include written, or the source file grabbed unless the content is new? They only change once a day or so and I don't want to hit the remote server on every page load.
I don't have access to crons on my server or I'd just have the script run once every few hours or so.
So I'm thinking I should either:
A. Compare the timestamp on the remote server page before doing my fopen with timestamp from the last fopen (somehow...I have no idea how to do this yet). Then go ahead with the fopen if they are different.
or
B. Compare the local file timestamp when I go to write it. This won't help load on the remote server but will let me only write the file locally if it's new. It this even worth it? Or should I just go ahead and write the local file each time?
$content = "Stuff I pulled from a remote server";
$archive = "/home/www/includes/file.php";
$writepointer = @fopen($archive, "w") or die("Error! Can't open file.");
@fwrite($writepointer, $content) or die("Error! Cant write to file.");
fclose($writepointer);
Thanks!!
Zdislaw