Fix: Missing the delete command

This commit is contained in:
Laurent Destailleur 2015-06-07 00:06:11 +02:00
parent b89473383c
commit c4ccf6f744

View File

@ -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