Search code examples
phpandroidweb-servicesmobilewurfl

Not Getting Mobile Handset Correct Screen size using Tera-WURFL


In my PHP Script i have used Tera-WURFL api to get the Screen resolution of mobile Handset but the result i am getting is not correct... here is a code ...

**<?php
require_once('Tera-Wurfl/TeraWurfl.php');

$wurflObj = new TeraWurfl(); 

$wurflObj->getDeviceCapabilitiesFromAgent();

echo "Markup: ".$wurflObj->getDeviceCapability("preferred_markup");

// see the display resolution
$width = $wurflObj->getDeviceCapability("resolution_width");
$height = $wurflObj->getDeviceCapability("resolution_height");
echo $_SERVER['HTTP_USER_AGENT'];
echo "<br/>Resolution: $width x $height<br/>";
?>**

What i have done wrong here??


Solution

  • You can download and use free 51Degrees.mobi Lite data and documentation from: http://sourceforge.net/projects/fiftyone/?source=directory

    You can use 51Degrees.mobi properties using the following code:

     <?php
    require_once('51Degrees.mobi.php');
    
    $ScreenPixelsHeight = $_51d["ScreenPixelsHeight"];
    $ScreenPixelsWidth = $_51d["ScreenPixelsWidth"];
    
    ?>
    

    Note: All the data stored in the $_51d array is stored as strings, you may have to convert $ScreenPixelsHeight and $ScreenPixelsWidth into a number.