Muhammad Rifky
Muhammad Rifky

Reputation: 75

php - How to get one String User Agent

I Have this user agent :

User Agent : Mozilla/5.0 (Linux; Android 7.1.2; Redmi 4A Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.158 Mobile Safari/537.36 FreeDDNS-APP

Now, how to just show "FreeDDNS-APP" with php ?

Upvotes: 1

Views: 4566

Answers (1)

Khoa Truong
Khoa Truong

Reputation: 933

For the basic logic, we can try with http://php.net/manual/en/function.get-browser.php#101125. We use $_SERVER['HTTP_USER_AGENT'] for analyzing the User Agent.

There are some useful libs here:

https://github.com/zsxsoft/php-useragent

https://github.com/WhichBrowser/Parser-PHP

Upvotes: 2

Related Questions