public function get($url, $data = null, $headers = [], $options = []) { return $this->createRequestShortcut('get', $url, $data, $headers, $options); }
public function updateWeather() { $client = new Client(); $response = $client->get('http://api.wunderground.com/api/fa62a2e2278b3297/conditions/q/PL/Lublin.json')->send(); if ($response->isOk) { $currentObs = $response->data['current_observation']; if (isset($currentObs['temp_c'])) { $this->temperature = $currentObs['temp_c']; } if (isset($currentObs['pressure_mb'])) { $this->pressure = $currentObs['pressure_mb']; } if (isset($currentObs['wind_kph'])) { $this->wind_speed = $currentObs['wind_kph']; } if (isset($currentObs['icon'])) { $this->conditions = $currentObs['icon']; } if (isset($currentObs['pressure_trend'])) { $this->pressure_trend = $currentObs['pressure_trend']; } if (isset($currentObs['observation_epoch'])) { $this->update_time = $currentObs['observation_epoch']; } if (isset($currentObs['feelslike_c'])) { $this->feels_like = $currentObs['feelslike_c']; } $this->save(); return true; } else { return false; } }