dev-master
9999999-devWorld Weather Online Local Weather API PHP implementation
MIT
The Requires
- php >=5.3.3
- webit/weather-api dev-master
by Daniel Bojdo
weather weather api wwo
Wallogit.com
2017 © Pedro Peláez
World Weather Online Local Weather API PHP implementation
Implementation of Local Weather API from http://www.worldweatheronline.com/, (*1)
$apiKey = 'your api key';
$request = new CityRequest($apiKey);
$request->setFormat(CityRequest::FORMAT_JSON); // json is default format
$request->setNumberOfDays(3); // default 2
$request->setCity('New York');
$request->setCountry('USA');
$proxy = new CurlProxy();
$response = $proxy->performRequest($request);
if($response->getSuccess()) {
echo $response->getCurrentWeather() . "\n";
foreach($response->getWeatherList() as $weather) {
echo $weather . "\n";
}
} else {
foreach($response->getErrors() as $error) {
echo $error . "\n";
}
}
World Weather Online Local Weather API PHP implementation
MIT
weather weather api wwo