<?php
header("Content-Type: text/html; charset=utf-8");
include_once '../api.wunderground.classes.inc.php';
# to get an api key register here http://www.wunderground.com/weather/api/
$which = 4;
# loading results by language or iso code
$weather = WundergroundWeather::getInstance("DE")
->apikey("--your api key here---");
switch($which){
case 0:
$weather->Geolookup()->CityCountry("Germany", "Erftstadt");
break;
case 1:
$weather->Forecast()->CityCountry("Germany", "Erftstadt");
break;
case 2:
$weather->Forecast10Day()->CityCountry("Germany", "Erftstadt");
break;
case 3:
$weather->History("20121201")->CityCountry("Germany", "Erftstadt");
break;
case 4:
// returns binary GIF image data
$weather->Layers()
->Radar(array("width"=>200, "height"=>200))
->CityCountry("MI", "Ann_Arbor");
break;
case 41:
$weather->Layers()
->Satellite(array("width"=>200, "height"=>200))
->CityCountry("MI", "Ann_Arbor");
break;
case 5:
$weather->Alerts()->CityCountry("Germany", "Erftstadt");
break;
case 6:
$weather->Almanac()->CityCountry("Germany", "Erftstadt");
break;
case 7:
$weather->Conditions()->CityCountry("Germany", "Erftstadt");
break;
case 8:
$weather->Planner("2012122710")->CityCountry("Germany", "Erftstadt");
break;
case 9:
$weather->Astronomy()->CityCountry("Germany", "Erftstadt");
break;
case 10:
$weather->Satellite()->CityCountry("Germany", "Erftstadt");
break;
case 11:
$weather->Hourly()->CityCountry("Germany", "Erftstadt");
break;
case 12:
$weather->Hourly10Day()->CityCountry("Germany", "Erftstadt");
break;
case 13:
$weather->Yesterday()->CityCountry("Germany", "Erftstadt");
break;
}
$weather->doRequest();
$result = $weather->getResult();
echo sprintf("<pre>%s</pre>", print_r($result, true));
|