Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is process to find OS version from web browsers using PHP ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 557
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss how to find OS version from web browsers using PHP ?
    If you want to get the OS version which you are using. Then you can use the library code below:-

     <?php
       //here craete a array of OS list and store in a variable
        $operating_system = array
        (
        // Match user agent string with operating systems
        'Windows 3.11' => 'Win16',
        'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)',
        'Windows 98' => '(Windows 98)|(Win98)',
        'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
        'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
        'Windows Server 2003' => '(Windows NT 5.2)',
        'Windows Vista' => '(Windows NT 6.0)',
        'Windows 7' => '(Windows NT 7.0)',
        'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
        'Windows ME' => 'Windows ME',
        'Open BSD' => 'OpenBSD',
        'Sun OS' => 'SunOS',
        'Linux' => '(Linux)|(X11)',
        'Mac OS' => '(Mac_PowerPC)|(Macintosh)',
        'QNX' => 'QNX',
        'BeOS' => 'BeOS',
        'OS/2' => 'OS/2',
        'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves/Teoma)|(ia_archiver)'
        );
        // use foreach loop
        foreach($operating_system as $Current_OS=>$Os_match)
        {
        // check a match
        if (eregi($Os_match, $_SERVER['HTTP_USER_AGENT']))
        {
        // get the correct match
        break;
        }
        }
        // print your current OS version
        echo "Hi user you are using ".$Current_OS;
        ?>
    

    The output of the code above will be:

    Hi user you are using Linux
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: