paulo@13: 0) paulo@13: $cache_mtime = filemtime($cache_fn); paulo@13: paulo@13: $newbody = ''; paulo@13: paulo@13: if ((time() - $cache_mtime >= $cache_life)) { paulo@13: $newbody = shell_exec('./myrss_update.sh'); paulo@13: file_put_contents($cache_fn, $newbody); paulo@13: } else { paulo@13: $newbody = file_get_contents($cache_fn); paulo@13: } paulo@13: paulo@13: $end_time = microtime(true); paulo@13: $elapsed_time = $end_time - $start_time; paulo@13: paulo@13: $newbody = preg_replace("/<\/BODY>/", "
Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.
\n", $newbody); paulo@13: echo $newbody; paulo@13: ?>