Solved

browscaps get OS version

Posted on 2012-03-12
3
381 Views
Last Modified: 2012-04-11
I can get the browser info as follows

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.13.81_10003810) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true

but, when I use the browscap.ini I only get that it is XYZ browser on a Mac OS X.  I want to know what version of the OS is installed.
0
Comment
Question by:lvmllc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 37712352
When you write, I can get the browser info as follows how do you get this information?

Please use var_dump() to print the output from the browscap instructions and post it here, thanks.
0
 

Author Comment

by:lvmllc
ID: 37718247
two examples - the first is capable of identifying the version of Mac OS X while the get_browser() does not.


echo $_SERVER['HTTP_USER_AGENT'];
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20100101 Firefox/10.0.2

$browser = get_browser(null,true);
var_dump($browser);

array(28) { ["browser_name_regex"]=> string(53) "^mozilla/5\.0 (.*mac os x.*) gecko/.* firefox/10\..*$" ["browser_name_pattern"]=> string(45) "Mozilla/5.0 (*Mac OS X*) Gecko/* Firefox/10.*" ["parent"]=> string(12) "Firefox 10.0" ["platform"]=> string(6) "MacOSX" ["win32"]=> string(0) "" ["browser"]=> string(7) "Firefox" ["version"]=> string(4) "10.0" ["majorver"]=> string(2) "10" ["frames"]=> string(1) "1" ["iframes"]=> string(1) "1" ["tables"]=> string(1) "1" ["cookies"]=> string(1) "1" ["javascript"]=> string(1) "1" ["javaapplets"]=> string(1) "1" ["cssversion"]=> string(1) "3" ["minorver"]=> string(1) "0" ["alpha"]=> string(0) "" ["beta"]=> string(0) "" ["win16"]=> string(0) "" ["win64"]=> string(0) "" ["backgroundsounds"]=> string(0) "" ["vbscript"]=> string(0) "" ["activexcontrols"]=> string(0) "" ["isbanned"]=> string(0) "" ["ismobiledevice"]=> string(0) "" ["issyndicationreader"]=> string(0) "" ["crawler"]=> string(0) "" ["aolversion"]=> string(1) "0" }
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 300 total points
ID: 37719758
OK, I think I understand your question.  The USER_AGENT string is dynamically generated by the client that initiated the request.  The get_browser() function looks up the browser's information in your browscap.ini file; browscap.ini relies on user updates to keep the database current.  Looks like it does not reveal details of the underlying platform.  To quote the BCP
User agent detection is still a long ways away from being 100% accurate...
You may find some useful information at this link.
http://browsers.garykeith.com/stream.asp?PHP_BrowsCapINI

Here is my USER_AGENT
Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20100101 Firefox/10.0.2

Looks like the best information you can get is from USER_AGENT.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question