2
I know that every http request made, whether by browser or other resource, sends a certain method (GET
, POST
, PUT
, DELETE
and etc.).
I’m thinking about building a Restful application with PHP, but I don’t know how I can find out what the current request method is, so I can validate it.
If it is a requisition GET
in a url that accepts only POST
, I want to return the Error 405
, which is the método não aceitável
.
How to know the current PHP request method?
A useful tip: Make a simple application that gives a var_dump($_REQUEST). There’s quite a useful thing there. (-:
– PerryWerneck
@Perrywerneck
$_REQUEST
or$_SERVER
?– Wallace Maxters
Oops! In this case $_SERVER. (-:
– PerryWerneck