public function WundergroundWeatherManager::requestData in Wunderground weather 8
Make a request to the ww server and return it as an array.
Parameters
array $options: Options build the request url.
Return value
array An array containing weather data.
File
- src/
WundergroundWeatherManager.php, line 61 - Contains Drupal\wunderground_weather\WundergroundWeatherManager.
Class
- WundergroundWeatherManager
- Methods to make an API call and tool to handle the output.
Namespace
Drupal\wunderground_weatherCode
public function requestData($options) {
$url = 'http://api.wunderground.com';
foreach ($options as $argument) {
$url .= '/' . $argument;
}
$url .= '.json';
$data = $this->httpClient
->request('GET', $url);
return json_decode($data
->getBody());
}