tags:

views:

142

answers:

2

How can I find out which method (usually GET or POST) is used for the current request?

+11  A: 
$_SERVER['REQUEST_METHOD']

See the docs. It will contain the request method upper-cased (i.e. 'GET', 'HEAD', 'POST', 'PUT').

Dominic Rodger
A: 
if (isset($_SERVER['HTTP_METHOD'])) {
  print  $_SERVER['HTTP_METHOD'];
}
Andrew Sledge
I can't find any reference to that key on http://us3.php.net/manual/en/reserved.variables.server.php
Dominic Rodger