/** Delete request @access public @throws Exception object @param string $serviceUri | String with the service uri @param array $parameters | Array with the parameters @param string $authorization | String with the authorization hash string @return object */ public function delete($serviceUri, $parameters = null, $authorization = null, $debug = false) { try { self::check_headers(); $curl = curl_init($this->Options["host"] . $serviceUri); curl_setopt($curl, CURLOPT_HTTPHEADER, self::build_header(Utility::build_http_query($parameters), $authorization)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($curl, CURLOPT_POSTFIELDS, Utility::build_http_query($parameters)); $curl_response = curl_exec($curl); $http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($curl_response === false) { throw new Exception('Error occured during curl exec. Additioanl info: ' . var_export(curl_getinfo($curl))); } $json = json_decode($curl_response); if (isset($json) && is_object($json)) { return (object) Utility::array_to_object(["payload" => json_decode($curl_response), "http_status" => ["http_method" => "POST", "code" => $http_status_code, "canonical_name" => HttpHandler::get_http_code_info($http_status_code)]]); } else { if ($debug) { $data = (object) Utility::array_to_object(["webservice_return" => trim(strip_tags($curl_response)), "http_status" => ["http_method" => "POST", "code" => $http_status_code, "canonical_name" => HttpHandler::get_http_code_info($http_status_code)]]); Utility::debug($data); } } } catch (Exception $e) { throw $e; } }