Solved

browscaps get OS version

Posted on 2012-03-12
3
376 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
  • 2
3 Comments
 
LVL 109

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 109

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
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…

776 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