PHP - detecting request type (GET, POST, PUT or DELETE)
Posted: 11 Jan 2015, 10:59
How can I detect which request type was used (GET, POST, PUT or DELETE) in a php script?
Web Development and Programming Courses
https://coursesweb.net/forum/
Code: Select all
$request = $_SERVER['REQUEST_METHOD'];
echo $request;
if($request === 'GET') {
// ...
}
else if($request === 'POST') {
// ...
}
else if($request === 'PUT') {
// ...
}
else if($request === 'DELETE') {
// ...
}