From c4ccf6f74461db500d9de8b205b8cffbdcab2d84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2015 00:06:11 +0200 Subject: [PATCH] Fix: Missing the delete command --- htdocs/core/lib/geturl.lib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 8f6847bcb9a..c02c896eb1b 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -28,7 +28,7 @@ * @param string $postorget 'POST', 'GET', 'HEAD' * @param string $param Parameters of URL (x=value1&y=value2) * @param string $followlocation 1=Follow location, 0=Do not follow - * @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) + * @param array $addheaders Array of string to add into header. Example: array('Accept: application/xrds+xml', ....) * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) */ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array()) @@ -76,13 +76,17 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' if ( ! is_array($param) ) parse_str($param, $array_param); - curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields } else if ($postorget == 'HEAD') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD' curl_setopt($ch, CURLOPT_NOBODY, true); } + else if ($postorget == 'DELETE') + { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); // POST + } else { curl_setopt($ch, CURLOPT_POST, 0); // GET