From cd4312e00fdec9ea8c886223585ac1afeda72a12 Mon Sep 17 00:00:00 2001 From: Baptiste Jamin Date: Thu, 26 Jul 2018 08:52:08 +0200 Subject: [PATCH] Fix an issue with HEAD requests On some sites, issues could be expected with HEAD requests --- restclient.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/restclient.php b/restclient.php index 3a69870..27ee19c 100755 --- a/restclient.php +++ b/restclient.php @@ -177,6 +177,9 @@ public function execute($url, $method='GET', $parameters=[], $headers=[]){ $curlopt[CURLOPT_POST] = TRUE; $curlopt[CURLOPT_POSTFIELDS] = $parameters_string; } + else if(strtoupper($method) == 'HEAD'){ + $curlopt[CURLOPT_NOBODY] = TRUE; + } elseif(strtoupper($method) != 'GET'){ $curlopt[CURLOPT_CUSTOMREQUEST] = strtoupper($method); $curlopt[CURLOPT_POSTFIELDS] = $parameters_string;