PHP code example of wurfl / wurfl-dbapi

1. Go to this page and download the library: Download wurfl/wurfl-dbapi library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wurfl / wurfl-dbapi example snippets


// Include the Tera-WURFL file
 object
$wurflObj = new TeraWurfl();

// Get the capabilities of the current client.
$wurflObj->getDeviceCapabilitiesFromAgent();

// see if this client is on a wireless device (or if they can't be identified)
if(!$wurflObj->getDeviceCapability("is_wireless_device")){
	echo "<h2>You should not be here</h2>";
}

// see what this device's preferred markup language is
echo "Markup: ".$wurflObj->getDeviceCapability("preferred_markup");

// see the display resolution
$width = $wurflObj->getDeviceCapability("resolution_width");
$height = $wurflObj->getDeviceCapability("resolution_height");
echo "<br/>Resolution: $width x $height<br/>";