php script that detect from user agent what is the device (mobile)?

徘徊边缘 提交于 2019-12-23 20:30:16

问题


I am try to write a php script that return the device from the user agent in the header.

the problem that i see that is not simple to do a regular expression, because the different between the device (am i wrong?)

so i want an updated list of mobile device according to the user agent

I found this list : List of user agents for mobile phones

I try to find an updated xml / feed that i can take all the kinds

or other way you think that best to do this .

thanks.


回答1:


I use this script in a project of mine

http://detectmobilebrowsers.mobi/

Works perfect.

All you need to do in your code is include mobile_device_detect.php and then the function mobile_device_detect() will return to you the device (Android, IPhone, ...) you're running on




回答2:


Here is your solution:

http://code.google.com/p/php-mobile-detect2/




回答3:


after alot of search i think the simple way is to use a web service

This means no downloads, no installs, no hassles... just simple!

http://www.wurflws.com/

EDIT:

The web service is not available now, i recommend to use http://deviceatlas.com/ or http://51degrees.mobi/ (commercial) or if you look on open source look on : Best Open Source WURFL alternative



来源:https://stackoverflow.com/questions/4275394/php-script-that-detect-from-user-agent-what-is-the-device-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!