Cron Jobs are probably better at this then PHP.However yo can do it with PHP like this.
PHP Code:
<?php
function update(){
//this will be called once per hour
return true;
}
$current_time = mktime();
$last_updated = file_get_contents("last_updated.txt");
$diff = $current_time - $last_updated;
if($diff >= 3600){
//it has been an hour since update
update();
if($fp = @fopen("last_updated.txt","w")) {
//Write time to file
$contents = fwrite($fp,$current_time);
fclose($fp);
}
else{
die("Could not write to file")
}
}
?>
Bookmarks