Do you know library for PHP that might help with parsing useragent string from browser? I want to extract at least those features:
- language
- browser (name and version)
- os (name and version)
Any help would be appreciated.
Do you know library for PHP that might help with parsing useragent string from browser? I want to extract at least those features:
Any help would be appreciated.
You can use get_browser(). Just make sure your database (the browscap.ini file) is up-to-date.
This is a partial duplicate of Code to parse user agent string?
You can use the get_browser() function in PHP to parse the user-agent header and retrieve the browser and the OS versions.
However, the language information is not sent as part of the user-agent string. Instead, you probably want to look at the "Accept-Languagr" header, i.e. $_SERVER["HTTP_ACCEPT_LANGUAGE"]