It seems like facebook has this mastered, I've chec开发者_运维百科ked a bit into WURFL but this seems like an extremely expensive process. I've also checked out: url link. While it has a good list of user agents, I'm trying to identify which are smart phones and which are not.
facebook pushes the non-smart phones to a different site than their smart phones. Trying to see if there was an easy way to do this.
You should look into Tera-WURFL which is basically WURFL serialized data in a MySQL database. Much better performance than XML WURFL.
There is also another mobile device db out there: Device Atlas.
What you could do is find the lowest common denominator for smartphones, then create your own stripped down version of WURFL / Device Atlas which would be far less resource intensive and faster to check, and go from there.
Screen size should be a somewhat reliable indicator. Non-smarts tend to have less than 320x240 resolution, though I'd check some older smartphone models to be sure.
Try wurfl-php-1.4.2.0
$isPhone = $device->getCapability("can_assign_phone_number");
$isSmarty = $device->getCapability("device_claims_web_support");
If it is a phone and smart, it is a smartphone. If it is a phone and it is not smart, it is a non-smartphone
精彩评论