Advertisement
Guest User

Forecast PHP

a guest
May 4th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. <?php
  2. // FORECAST //////////////////////////////////////////////////////////////////////////////////////////
  3.  
  4. $QueryForecastDecode = json_decode('Wunderground URL geolookup/conditions/forecast/q/autoip.xml');
  5.  
  6. // build forecast array // forecast array structure: Day, Hi, Lo, ForecastText, ForecastIconURL, PrecipPercent
  7. $f = 0;
  8. $ForecastArray = array();
  9. while ($QueryForecastDecode->{'forecast'}->{'simpleforecast'}->{'forecastday'}[$f]) {
  10.         $Forecasts = $QueryForecastDecode->{'forecast'}->{'simpleforecast'}->{'forecastday'}[$f];
  11.         $ForecastArray[$f] = array(
  12.                 $Forecasts->{'date'}->{'weekday_short'},
  13.                 $Forecasts->{'high'}->{'fahrenheit'},
  14.                 $Forecasts->{'low'}->{'fahrenheit'},
  15.                 $Forecasts->{'conditions'},
  16.                 $Forecasts->{'icon_url'},
  17.                 $Forecasts->{'pop'}
  18.         );
  19.         $f++;
  20. }
  21.  
  22. ?>
  23. <DOCTYPE html>
  24.  
  25. <html>
  26.  
  27. <body>
  28.  
  29. <?php echo $ForecastArray; ?>
  30.  
  31. </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement