Get OS and Browser Name from php script

Hitesh's Blog

The below mention code will fetch the browser and OS details of remote computer which uses your php script.

<?php $user_agent     =   $_SERVER['HTTP_USER_AGENT']; function getOS() { global $user_agent; $os_platform    =   "Unknown OS Platform"; $os_array       =   array( '/windows nt 6.2/i'     =>  'Windows 8', '/windows nt 6.1/i'     =>  'Windows 7', '/windows nt 6.0/i'     =>  'Windows Vista', '/windows nt 5.2/i'     =>  'Windows Server 2003/XP x64', '/windows nt 5.1/i'     =>  'Windows XP', '/windows xp/i'         =>  'Windows XP', '/windows nt 5.0/i'     =>  'Windows 2000', '/windows me/i'         =>  'Windows ME', '/win98/i'              =>  'Windows 98', '/win95/i'              =>  'Windows 95', '/win16/i'              =>  'Windows 3.11', '/macintosh|mac os x/i' =>  'Mac OS X', '/mac_powerpc/i'        =>  'Mac OS 9', '/linux/i'              =>  'Linux', '/ubuntu/i'             =>  'Ubuntu', '/iphone/i'             =>  'iPhone', '/ipod/i'               =>  'iPod', '/ipad/i'               =>  'iPad', '/android/i'            =>  'Android', '/blackberry/i'         =>  'BlackBerry', '/webos/i'              =>  'Mobile' ); foreach ($os_array as $regex => $value) { if (preg_match($regex, $user_agent)) { $os_platform    =   $value; } } return…

View original post 141 more words


3 thoughts on “Get OS and Browser Name from php script

  1. Undeniably believe that which you said. Your favorite reason
    seemed to be on the net the simplest thing to be aware
    of. I say to you, I certainly get annoyed while people think about worries that they just do not know
    about. You managed to hit the nail upon the
    top as well as defined out the whole thing without having side effect ,
    people can take a signal. Will likely be back to get more.

  2. Thanks for the marvelous posting! I seriously enjoyed reading it, you
    happen to be a great author. I will make sure to bookmark your blog and
    will eventually come back down the road. I want to encourage you continue your great work, have a nice day!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s