_sensor->getData(); $url = $data["Url"]; $method = isset($data["Method"]) ? $data["Method"] : "GET"; $options = isset($data["Options"]) ? $data["Options"] : array(); $client = new Client(); try { $response = $client->request($method, $url, $options); } catch (ClientException $e) { $response = $e->getResponse(); if (!is_null($response)) { LuLog::log($response->getBody()); } LuLog::log($e); abort(500, "Failed to execute request (client)"); } catch (RequestException $e) { $response = $e->getResponse(); if (!is_null($response)) { LuLog::log($response->getBody()); } LuLog::log($e); abort(500, "Failed to execute request (request)"); } catch (\Exception $e) { LuLog::log($e); abort(500, "Failed to execute request (unknown)"); } if ($response->getStatusCode() != 200) { abort(500, "Failed to execute request (" . $response->getStatusCode() . ")"); } $mapping = isset($data["Mapping"]) ? $data["Mapping"] : array(); $value = new SensorsValueDbo(); $value->setValue($this->map((string) $response->getBody(), $mapping)); return $value; } }