I am using curl in php
how can i use delete request using curl?
this is my code:
<?php
$ch = curl_init('http://192.168.236.44/confbridges/1.json');
curl_exec($ch);
if(!curl_errno($ch))
{
$info = curl_getinfo($ch);
}
curl_close($ch);
?>
You need to add CURLOPT_CUSTOMREQUEST for DELETE request as:
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
A custom request method to use instead of "GET" or "HEAD" when doing a HTTP request. This is useful for doing "DELETE" or other, more obscure HTTP requests. Valid values are things like "GET", "POST", "CONNECT" and so on; i.e. Do not enter a whole HTTP request line here. For instance, entering "GET /index.html HTTP/1.0\r\n\r\n" would be incorrect.