wlk
wlk

Reputation: 5785

Useragent parsing library for PHP?

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.

Upvotes: 3

Views: 3321

Answers (2)

sagi
sagi

Reputation: 5737

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"]

Upvotes: 3

Álvaro González
Álvaro González

Reputation: 146450

You can use get_browser(). Just make sure your database (the browscap.ini file) is up-to-date.

Upvotes: 3

Related Questions