How to fetch and print all HTTP request headers in PHP

1 Answer

0 votes
foreach (getallheaders() as $name => $value) 
    echo "$name: $value <br />";



/*
run:

Cookie: DBGSESSID=; __atuvc=26%7C25 
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; ...
Connection: Keep-Alive 
Host: localhost:8080
Accept-Language: he-IL 
Accept-Encoding: gzip, deflate 
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, ...

*/

 



answered Jun 22, 2016 by avibootz
edited Jun 23, 2016 by avibootz

Related questions

1 answer 229 views
1 answer 113 views
1 answer 121 views
...