Search code examples
phpbrowserstatisticsweb-trafficvisitor-statistic

How reliable is php function get_browser?


I am trying to find a good way to detect a visitor OS, browser, etc.

I found the PHP function get_browser

And I see that function can detect Java, I though the function used the user agent for detection, and I don't see any mention to Java on my VMs ua with java installed.

How does the function knows?


Solution

  • It's as accurate as your browscap.ini file is. The file isn't bundled with PHP so it's up to you to keep it up-to-date. You can get it from http://browsers.garykeith.com/downloads.asp.

    Notice: The values contained in the array are based on the "technical capabilities" of the browser and do not account for features that were disabled by the user (i.e. the user may have disabled JavaScript).