Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mobile browser detection?

I'm in need of a way to detect mobile browsers server-side. I'd like a way that requires me to do little to set up and little to maintain, yet still provide me with accurate detection of (at the VERY least) Android, Mobile Safari and Blackberry browsers, along with alternatives like Opera.

I'd like to have at least the majority of the mobile market covered, and I'd really prefer virtually all of the market if it doesn't take much.

like image 804
Trey Keown Avatar asked Sep 28 '10 21:09

Trey Keown


People also ask

How does my tablet detect PHP?

The only way to do this is with a huge lookup table of User-Agent: strings. get_browser() would probably be able to do what you want, but you would need to make sure that you keep the browscap file very up to date - new tablet models are being released on a weekly basis.

How can I get browser information in PHP?

The get_browser() function in PHP is an inbuilt function that is used to tell the user about the browser's capabilities. This function looks up the user's browscap. ini file and returns the capabilities of the user's browser.


2 Answers

WURLF is the ultimate way for mobile browser detection and a PHP API is available.

like image 190
kgiannakakis Avatar answered Sep 20 '22 18:09

kgiannakakis


I found this one to be very easy to use php-mobile-detect

like image 33
Ali Nouman Avatar answered Sep 18 '22 18:09

Ali Nouman