Problem:- How to Read HTTP Header in PHP
Solution 1:-
<?php echo $_SERVER['HTTP_USER_AGENT']; ?>
Output:-
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
Solution 2:-
<?php $header = getallheaders(); ?> <pre> <?php print_r($header); ?> </pre>
Output:-
Array ( [Host] => localhost [User-Agent] => Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0 [Accept] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [Accept-Language] => en-US,en;q=0.5 [Accept-Encoding] => gzip, deflate [Referer] => http://localhost/jquery/login.php [Cookie] => cookie name will here [Connection] => keep-alive [Upgrade-Insecure-Requests] => 1 [Cache-Control] => max-age=0 )
Also Read:- Control Over User Login Procedure – Cookies Authentication