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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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”]