client = new Client(["base_uri" => $url]); $this->profile = $profile; } private function getOptions() { $options = ["allow_redirects" => false]; $options["timeout"] = $this->profile->getHttpProfile()->getReqTimeout(); $options["proxy"] = $this->profile->getHttpProfile()->getProxy(); return $options; } public function getRequest($uri = '', $query = [], $headers = []) { $options = $this->getOptions(); if ($query) { $options["query"] = $query; } if ($headers) { $options["headers"] = $headers; } return $this->client->get($uri, $options); } public function postRequest($uri = '', $headers = [], $body = '') { $options = $this->getOptions(); if ($headers) { $options["headers"] = $headers; } if ($body) { $options["form_params"] = $body; } return $this->client->post($uri, $options); } public function postRequestRaw($uri = '', $headers = [], $body = '') { $options = $this->getOptions(); if ($headers) { $options["headers"] = $headers; } if ($body) { $options["body"] = $body; } return $this->client->post($uri, $options); } }