This is very simple code snippet that displays the users current user-agent string.

<html>
 <head>
  <title>
   What's your user-agent
  </title>
 </head>
 <body>
  Your User-agent is :<br>
  <?php
   $strUseragent = getenv("HTTP_user_agent");
   print($strUseragent);
  ?>
 </body>
</html>

This would output something like this:

Your User-agent is :
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4

Tagged with: