Fetches all HTTP headers from the current request
print_r(json_encode(getallheaders()));
The result of the above code is:
{
    "Content-Type": "application/json",
    "User-Agent": "PostmanRuntime/7.26.8",
    "Accept": "*/*",
    "Postman-Token": "a89b677d-776a-45d7-988c-f18ad2512522",
    "Host": "localhost",
    "Accept-Encoding": "gzip, deflate, br",
    "Connection": "keep-alive",
    "Content-Length": "137"
}
by Valeri Tandilashvili
4 years ago
PHP
functions
1
Pro tip: use ```triple backticks around text``` to write in code fences