Mercurial > hg > index.fcgi > www > www-1
view myrss/index.php @ 88:583400dc28a0
myrss: update user-agent string to "Mozilla/5.0 Browser" after some servers complain about "Mozilla/5.0"; show exception type in top-level exception handler log message
author | paulo |
---|---|
date | Thu, 12 Jan 2017 00:59:05 -0700 |
parents | f93693980ead |
children |
line source
1 <?php
2 umask(0037);
4 $start_time = microtime(true);
6 $cache_fn = "__cache__.html";
7 $cache_life = "1200";
9 $cache_mtime = "0";
10 if (file_exists($cache_fn) && filesize($cache_fn) > 0)
11 $cache_mtime = filemtime($cache_fn);
13 $newbody = '';
15 if ((time() - $cache_mtime >= $cache_life)) {
16 $newbody = shell_exec('./myrss_update.sh 2>&1');
17 file_put_contents($cache_fn, $newbody);
18 } else {
19 $newbody = file_get_contents($cache_fn);
20 }
22 $end_time = microtime(true);
23 $elapsed_time = $end_time - $start_time;
25 $newbody = preg_replace("/<\/BODY>/", "<DIV class=\"debug\">Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.</DIV>\n</BODY>", $newbody);
26 echo $newbody;
27 ?>