I am creating a traffic analysis script. I am aware of $_SERVER['HTTP_USER_AGENT'] however I need to break that up into its separate parts so I can then insert them into a database. From it I need the following information: Browser name Browser version Language Operating system/Platform Is there anyway I can break it up to put these into an array? Perhaps there is already a function out there which will do it. Thanks
There is a PHP function split() which can split a string based on a separator and create an array. But this may not help you. Your best bet would be to check for the existence of common type of these elements.
get_browser() requires a browscap.ini config file in order to work. If you get a warning from php when trying to use the function, you can find a browscap.ini file here: http://browsers.garykeith.com/downloads.asp Be sure to download the PHP version. Then, make sure you set the location in php.ini: browscap = "/path/to/browscap.ini" note: there is no e in browscap! You can verify that the value is set by looking at the output from phpinfo()
There isn't standard browser signature, in some browsers you will find all this information, some don't , and each one with different order. Major browsers timeline: http://upload.wikimedia.org/wikipedia/commons/7/74/Timeline_of_web_browsers.svg
You are probably better off using something like this: http:// pear.php.net/package/Net_UserAgent_Detect
Thanks for all the help I will be using a standalone function which basically does exactly what get_browser() does - http://alexandre.alapetite.net/doc-alex/php-local-browscap/index.en.html Thanks