I'm reading through the explanations of REST api here and there is the following code block there:
$this->method = $_SERVER['REQUEST_METHOD'];
if ($this->method == 'POST' && array_key_exists('HTTP_X_HTTP_METHOD', $_SERVER)) {
if ($_SERVER['HTTP_X_HTTP_METHOD'] == 'DELETE') {
$this->method = 'DELETE';
} else if ($_SERVER['HTTP_X_HTTP_METHOD'] == 'PUT') {
$this->method = 'PUT';
} else {
throw new Exception("Unexpected Header");
}
}
My question is what is $_SERVER['HTTP_X_HTTP_METHOD']? I've googled around and the only thing I've found is the usage of X-HTTP-Method-Override header to transfer desired method of execution through POST method. Actually the code above seems like it's doing exactly it. So is it?