updated removed
[home-automation.git] / weather1.php
1 <?
2 include("xml2array.php");
3
4 $ch = curl_init();
5
6 curl_setopt($ch, CURLOPT_URL,"http://weather/weather/all-output.xml");
7
8 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
9 curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
10 curl_setopt($ch, CURLOPT_USERPWD, 'admin:admin');
11
12 $output = curl_exec($ch);
13
14 #echo "<pre>";
15 $array=xml2array($output);
16 #print_r($array);
17 ?>
18
19 <table border=0>
20 <tr align='center' style='background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), color-stop(51%,#207cca), color-stop(100%,#7db9e8));background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 );'><td>Temperature</td><td>Wind</td><td>Rain</td><td>Wind Chill</td></tr>
21 <tr align='center'><td rowspan=3 align=center>
22 <?
23   echo $array['rss']['weather']['outsideTemp']." &deg;F<br>";
24   $temp=$array['rss']['weather']['outsideTemp'];
25   $mint=$array['rss']['weather']['lowOutsideTemp'];
26   $maxt=$array['rss']['weather']['hiOutsideTemp'];
27   echo "<table border=0>";
28   echo "<tr align=center><td>";
29   echo "<img src='thermometer.php?t=$temp&mint=$mint&maxt=$maxt'>";
30   echo "</td><td> Feels like<br>".$array['rss']['weather']['windchill']." &deg;F<br>";
31   echo "</td></tr></table>";
32   echo "<table border=0>";
33   echo "<tr align=center style='background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), color-stop(51%,#207cca), color-stop(100%,#7db9e8));background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 );'><td>Temp</td><td>High</td><td>Low</td></tr>";
34   echo "<tr align=center><td rowspan=2>Today:</td><td>$maxt &deg;F</td><td>$mint &deg;F</td></tr>";
35   echo "<tr align=center><td>".$array['rss']['weather']['hiOutsideTempTime']."</td><td>".$array['rss']['weather']['lowOutsideTempTime']."</td></tr>";
36   echo "</table>";
37 ?>
38
39 </td><td>
40
41 <?
42   echo $array['rss']['weather']['winddirection']."<br>";
43   echo $array['rss']['weather']['windspeed']." MPH<br>";
44   echo $array['rss']['weather']['windBeaufortScale']."<br>";
45   echo "Max wind ".$array['rss']['weather']['hiWindSpeed']." MPH at ".$array['rss']['weather']['hiWindSpeedTime'];
46 ?>
47
48 </td><td>
49 <table border=0>
50 <?
51   echo "<tr align=center><td>Today:</td><td>".$array['rss']['weather']['dailyRain']."</td></tr>";
52   echo "<tr align=center><td>Rate (/hr):</td><td>".$array['rss']['weather']['rainrate']."</td></tr>";
53   echo "<tr align=center><td>High Rate:</td><td>".$array['rss']['weather']['hiRainRate']."</td></tr>";
54   echo "<tr align=center><td>Month Total:</td><td>".$array['rss']['weather']['monthlyRain']."</td></tr>";
55   echo "<tr align=center><td>Rain Season:</td><td>".$array['rss']['weather']['totalRain']."</td></tr>";
56 ?>
57 </table>
58 </td><td>
59 <table border=0>
60 <?
61   echo "<tr align=center><td>Current:</td><td>".$array['rss']['weather']['windchill']." &deg;F</td></tr>";
62   echo "<tr align=center><td>Low:</td><td>".$array['rss']['weather']['lowWindchill']." &deg;F<br>at ".$array['rss']['weather']['lowWindchillTime']."</td></tr>";
63 ?>
64 </table>
65 </td></tr>
66 <tr align='center'><td style='background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), color-stop(51%,#207cca), color-stop(100%,#7db9e8));background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 );'>Barometer</td><td style='background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1E5799), color-stop(50%,#2989D8), color-stop(51%,#207cca), color-stop(100%,#7db9e8));background: -moz-linear-gradient(top, #1E5799 0%, #2989D8 50%, #207cca 51%, #7db9e8 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1E5799', endColorstr='#7db9e8',GradientType=0 );'>Humidity/Dew Point</td><td></td>
67 <tr align='center'><td>
68 <table border=0>
69 <?
70   echo "<tr align=center><td>Current:</td><td>".$array['rss']['weather']['barometer']." inHg</td></tr>";
71   echo "<tr align=center><td>1-Hr Trend:</td><td>".$array['rss']['weather']['baromtrend']."</td></tr>";
72 ?>
73 </table>
74 </td><td>
75 <table border=0>
76 <?
77   echo "<tr align=center><td>Humidity:</td><td>".$array['rss']['weather']['outsideHumidity']." %</td></tr>";
78   echo "<tr align=center><td>Today:</td><td>H: ".$array['rss']['weather']['hiHumidity']."%<br>L: ".$array['rss']['weather']['lowHumidity']."%</td></tr>";
79   echo "<tr align=center><td>Dew Point:</td><td>".$array['rss']['weather']['outsideDewPt']." &deg;F</td></tr>";
80 ?>
81 </table>
82
83 </td><td></td>
84 </table>
85
86 <?php 
87   include("weather-footer.php");
88 ?>
89