url = $url; $this->http_client = new curl\Curl(); } private function sendRequest($path, $json = null, $method = 'get') { $url = $this->url . '/' . $path; $this->http_client->reset(); $this->http_client->setOption(CURLOPT_TIMEOUT, 3600); $this->http_client->setOption(CURLOPT_HTTPHEADER, ['Content-Type: application/json', ]); if (!empty($json)) { $this->http_client->setOption(CURLOPT_POSTFIELDS, $json); } $result = $this->http_client->$method($url); if ($this->http_client->responseCode !== 200) { throw new \Exception("Call to ZM failed: " . $this->http_client->responseCode . "\n" . $result); } return $result; } public function getVersion() { return $this->sendRequest('host/getVersion.json'); } }