views:

203

answers:

2

What is the best way to get current weather via API ?

Could you make some example with this API ?

+2  A: 

Global Weather SOAP Webservice API

Using PHP (with the SOAP module enabled in your php.ini):

$client = new SoapClient("http://www.webservicex.net/globalweather.asmx?wsdl");
$params = new stdClass;
$params->CityName= 'Auckland';
$params->CountryName= 'New Zealand';
$result = $client->GetWeather($params);
// Check for errors...
$weatherXML = $result->GetWeatherResponse;

$weatherXML should then contain an XML document that contains humidity, temperature, sky conditions, wind etc that you can adapt to your needs. You can easily play with the online demo on www.webservice.net anyway to get a feel for things.

hydrogen
+2  A: 

Try Services_Weather on pear. It does Global Weather, METAR, et. al.

Seth