comparison weather/index.php @ 31:fa86ad0325ad

thule_fit_kits/fitkits_Thule.txt: update with what's on the server currently
author paulo@localhost
date Sun, 08 Jan 2012 17:57:08 -0800
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:69ae6a55373c
1 <HTML>
2 <HEAD>
3 <TITLE>Weather</TITLE>
4 <LINK REL="stylesheet" TYPE="text/css" HREF="index.css">
5 </HEAD>
6
7 <BODY>
8
9 <?php
10 umask(0037);
11
12 $start_time = microtime(true);
13
14 $cache_fn = "__cache__.txt";
15 $cache_life = "86400";
16
17 $cache_mtime = "0";
18 if (file_exists($cache_fn) && filesize($cache_fn) > 0)
19 $cache_mtime = filemtime($cache_fn);
20
21 $newbody = '';
22
23 if ((time() - $cache_mtime >= $cache_life)) {
24 $newbody = shell_exec('./getweather.sh');
25 file_put_contents($cache_fn, $newbody);
26 } else {
27 $newbody = file_get_contents($cache_fn);
28 }
29
30 $end_time = microtime(true);
31 $elapsed_time = $end_time - $start_time;
32
33 echo "<PRE>";
34 echo $newbody;
35 echo "</PRE>";
36
37 echo "<DIV class=\"debug\">Time elapsed: " . sprintf("%.3f", $elapsed_time) . " seconds.</DIV>";
38 ?>
39
40 </BODY>
41 </HTML>