PHP - detecting request type (GET, POST, PUT or DELETE)
-
- Posts:186
PHP - detecting request type (GET, POST, PUT or DELETE)
How can I detect which request type was used (GET, POST, PUT or DELETE) in a php script?
Admin
Posts:805
Simple use $_SERVER['REQUEST_METHOD'].
Code: Select all
$request = $_SERVER['REQUEST_METHOD'];
echo $request;
if($request === 'GET') {
// ...
}
else if($request === 'POST') {
// ...
}
else if($request === 'PUT') {
// ...
}
else if($request === 'DELETE') {
// ...
}
Similar Topics
- Redirect according to browser type
JavaScript - jQuery - Ajax First post
Pleasant Coursesweb,Last post
I have two `simple` javascript what I wanna combine between detecting in two different browsers to script to another page....
Marplo thanks for quick feedback took me more hours, I should have come earlier with asking questions.
It is a waste I`m not have experiance with... - GET_id not working in UnLink (delete file)
PHP - MySQL First post
I searching for an hour for a solution; unlink seems not to work with GET idLast post
<?php
$id = (int) $_GET ;
echo $_GET ;
$file = fopen( '.$_GET...
Here is an answer `o god after 2 hours shame on me for this one`
<?php
$file_pointer = $_GET .'.txt';
if (!unlink($file_pointer)) {
echo (...