Vai al contenuto

Getting request headers in PHP

Getting request headers in PHP
* getallheaders(): array: https://www.php.net/manual/en/function.getallheaders.php, it's crappy as it depends on Apache and thus not always present
Other method is reading $_SERVER['HTTP_' . header_name] (all uppercase):

PHP
$_SERVER['HTTP_HOST']; // example, returns `Host` header content