By default, PHP Curl supports GET
and POST
requests. It is possible to also send custom requests, such as DELETE
, PUT
or PATCH
(or even non-standard methods) using the CURLOPT_CUSTOMREQUEST
parameter.
$method = 'DELETE'; // Create a DELETE request
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
$content = curl_exec($ch);
curl_close($ch);