I never see how is PUT/DELETE request sent.
How to do it in PHP?
I know how to send a GET/POST request with curl:
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile);
curl_setopt($ch, CURLOPT_COOKIEFILE,$cookieFile);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
But how to do PUT/DELETE request?
For
DELETEusecurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');For
PUTusecurl_setopt($ch, CURLOPT_PUT, true);An alternative that doesn’t rely on cURL being installed would be to use
file_get_contentswith a custom HTTP stream context.Check out these two articles on doing REST with PHP