PHP Curl Delete Request Example Tutorial
Hi Guys,
Today,I will learn you how to create curl delete request example in php. We will show example of curl delete request in php. Hear we will show you how to call curl with delete. wh have create one function it will call cutl methods DELETE in a RESTful API. this code and post will helped you for implement how to call curl with delete.
The delete request is very simple again. We can just hit the API url with the $id we want to remove and poof… it’s gone forever.
Example
<?php
$url = "https://api.mywebtuts.com/api/users/2";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
$result = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $result;
?>
It will help you...
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example