Creating and sending a request with a custom method

suggest change

The cURL extension sends a GET request unless another method is set. CURLOPT_CUSTOMREQUEST sets the method, including DELETE, PUT, PATCH, or a non-standard method.

$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);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents