_client = new Client(); $data = $camera->getData(); $this->_url = "http://" . $data["Host"] . ":" . $data["Port"] . self::URI; } public function prepareImage() { $username = $this->_camera->getData()["Username"]; $passwd = $this->_camera->getData()["Password"]; try { $response = $this->_client->request('GET', $this->_url, ['auth' => [ $username, $passwd ]]); $data = (string)$response->getBody(); $this->_image = $this->_imagine->load($data); } catch (\Exception $e) { LuLog::log($e); } } }