In this example, I’ll fetch weather information for London Heathrow, an airport in England, UK. But you can easily see which variables will have to be changed in order to fetch weather information from a different source.
For this we will use WebserviceX.com to hand us the information. To start with, we need to get a webrequest going to ask for the weather information. After this, we can list the airports of a certain country with a simple query.
$weather = New-WebServiceProxy -Uri http://www.webservicex.com/globalweather.asmx?WSDL $city = ([xml]$weather.GetCitiesByCountry(‘United Kingdom’)).NewDataSet.Table | Select-Object -ExpandProperty City $city
This gives you quite a few results, here’s a screenshot showing off some of them.
Next we want to fetch the weather data for one particular airport.
$weather = New-WebServiceProxy -uri http://www.webservicex.com/globalweather.asmx?WSDL $data = ([xml]$weather.GetWeather(‘London / Heathrow Airport’,'United Kingdom')).CurrentWeather $data