为此,我可以推荐 WURFL。它是一个 XML 文件,描述了数千种移动设备的功能,并与 .NET、Java、PHP 等可用的 API 相结合,可以根据请求特征(主要是用户代理标头)识别它是哪个设备。
网页有点混乱,急需更新,但数据库和 API 本身非常健全。
I can recommend WURFL for this. It's an XML file describing the capabilities of thousands of mobile devices, and combines with APIs available for .NET, Java, PHP, etc, which can recognise which device it is based on the request characteristics (primarily the user-agent header).
The web page is a bit chaotic and in sore need of an update, but the database and APIs themselves are very sound.
If you have User-Agent, you can use following modules, I am sharing modules for Python:
https://github.com/tobie/ua- To parse the User-Agent, you will get Vendor name and handset (tablets/Mobile phones) information. You can pass this information to the following module to get handset info.
https://handsetdetection.readme.io/v4/docs You need to login and get user id, secret key and site id from the site after logging in. Secondly, create the config file preferably yaml and set the attributes. Now you can grammatically detect as well as fetch the device info and use as you may. Thanks.
发布评论
评论(6)
检查用户代理的价值是最常见的方法,有几个开源解决方案可以为您做到这一点。尝试用谷歌搜索它们。
这是一个例子:
http://detectmobilebrowser.com/
这也是一个有趣的解决方案:
http://mobiforge.com/developing/story/lightweight-device-detection- php
Checking value of user agent is the most common way, there are couple of open source solutions that do that for you.. try Googling for them.
Here is one example:
http://detectmobilebrowser.com/
And here's also one interesting solution:
http://mobiforge.com/developing/story/lightweight-device-detection-php
为此,我可以推荐 WURFL。它是一个 XML 文件,描述了数千种移动设备的功能,并与 .NET、Java、PHP 等可用的 API 相结合,可以根据请求特征(主要是用户代理标头)识别它是哪个设备。
网页有点混乱,急需更新,但数据库和 API 本身非常健全。
I can recommend WURFL for this. It's an XML file describing the capabilities of thousands of mobile devices, and combines with APIs available for .NET, Java, PHP, etc, which can recognise which device it is based on the request characteristics (primarily the user-agent header).
The web page is a bit chaotic and in sore need of an update, but the database and APIs themselves are very sound.
有一些服务可以为您做到这一点。 http://www.handsetdetection.com/ 可以让这一切变得简单。
There are services that can do this for you. http://www.handsetdetection.com/ is one that makes it easy.
似乎您必须使用用户代理字符串。可以在此处找到一份不错的列表(尽管不一定是最新的)。
Seems like you'd have to use the User Agent string. A decent list (though not necessarily up to date) can be found here.
手机检测需要两个标头参数。
请参考这个简单的示例(Restlet):
http://shengchien.blogspot.com/2010/09/restful-mobile-detection.html
There are two header parameters you would need for handset detection.
Please refer to this simple example (Restlet):
http://shengchien.blogspot.com/2010/09/restful-mobile-detection.html
如果你有 User-Agent,你可以使用以下模块,我正在分享 Python 模块:
https: //github.com/tobie/ua-
要解析用户代理,您将获得供应商名称和手机(平板电脑/手机)信息。
您可以将此信息传递给以下模块以获取手机信息。
https://handsetdetection.readme.io/v4/docs
您需要登录并在登录后从站点获取用户 ID、密钥和站点 ID。其次,创建配置文件(最好是 yaml)并设置属性。现在,您可以按照语法检测并获取设备信息并根据需要使用。
谢谢。
If you have User-Agent, you can use following modules, I am sharing modules for Python:
https://github.com/tobie/ua-
To parse the User-Agent, you will get Vendor name and handset (tablets/Mobile phones) information.
You can pass this information to the following module to get handset info.
https://handsetdetection.readme.io/v4/docs
You need to login and get user id, secret key and site id from the site after logging in. Secondly, create the config file preferably yaml and set the attributes. Now you can grammatically detect as well as fetch the device info and use as you may.
Thanks.