Home / Utilities


Utilities Home

Alembik
 Alembik Media Transcoding Server is a Java application providing transcoding services for a variety of clients.


GAIA Reply
 GAIA Image Trascoder
Open Source library that operates image transcoding, with a special focus on mobile applications.

WURFLTera
 Tera-WURFL
Use MySQL as a WURFL-powered backend!!!

WURFL Utilities
 mDevInf
GUI to query *your* WURFL, by James McLachlan

Device Thumbnails
 Device Thumbnails
Add device thumbnails to your appliction!

PHP Image Rendering Library (II)
 Dynamically resizing pictures in PHP (a new one)


PHP Image Rendering Library
 Dynamically resizing pictures in PHP


BeeWeeb's MWT
 Mobile Web Toolkit
Open Source library that talks to the same publishing system as your website, but generates a mobile site.

Wallify
 Wallify
Turn a CHTML site into a WALL site.

Image Server
 Image Server
A Java Servlet (and filter) that will intercept requests to picture and resize the picture appropriately by looking at the screen size. Very Cool!





SourceForge.net Logo
 

Tera WURFL
by Steve Kamerman, kamermans at teratechnologies dot net

Tera-WURFL History

Tera-WURFL is a PHP & MySQL based library that uses the Wireless Universal Resource File (WURFL) to identify specific device capabilities and features.
Although it was originally based on the WURFL PHP Tools by Andrea Trasatti, most of the code has been optimized and alterered for use with a MySQL database backend.
In late 2006 I evaluated the PHP Tools package by having it test over 100 unique user agents and http-accept headers and found that it was very slow, taking over 20 seconds to complete. The file-based caching mechanism did speed things up a bit the second time around, but I didn't like the idea of thousands of cache files floating around, so I decided to speed things up a bit. After a couple days of programming, I got an Alpha version of Tera-WURFL up and running, using a MySQL database instead of the filesystem. Initial test results were promising, showing a very large speed gain; but the library was far from finished! Now, after a few months of work, it can be used as a drop in replacement for the original PHP Tools and supports many other new features that make it easier to update and use. In case you're wondering where Tera came from, it is from my company, Tera Technologies.

This page requires Adobe Flash Player.

Features

  • Same usage, method and property names as PHP Tools for compatibility.
  • Extremely fast MySQL backend.
  • Easy installation.
  • Full featured web administration interface.
  • Ability to update your WURFL over the web with one click (you can choose the stable or development release).
  • Compatibility with WALL4PHP - you can download Tera-WURFL with WALL4PHP already configured for use.
  • Support for the WURFL device images by André van den Heever and Luca Passani
    allows you to see an image of the device under evaluation.
  • Support for custom WURFL patches allowing you to customize your WURFL.

Requirements

  • PHP >= 4.3.1
  • MySQL >= 4.1
  • Tera-WURFL should be operating system independent but has only been tested in Linux.

Installation

  1. Copy the files into a directory on your webserver that can be accessed
    from the internet.
  2. Create a new database for Tera-WURFL and a user that has a minimum of
    the following privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER.
  3. Edit the tera_wurfl_config.php file and make sure you have the database
    settings correct.
    a. Make sure WURFL_PATCH_ENABLE is set to false until you get it going
    this could cause issues if you haven't built the database yet.
    b. Make sure the DB_EMPTY METHOD is set to "DROP_CREATE" - this will
    automatically create the database tables for you.
  4. Set DATADIR to a directory that is accessible (read+write) by the user
    that runs your webserver. This is normally "apache", "www-data" or
    "nobody" on Linux. (i.e. chown -R apache:apache ./data/)
  5. Go to http://yourwebserver/tera_wurfl_directory/admin/
    a. You should see the Tera-WURFL administration. As of version 1.4.4,
    this package comes with a stable release of the wurfl.xml file.
    Since this file is constantly updated with new devices, the Web Admin
    Interface
    has two options for updating your wurfl database from the
    official WURFL website: 1. the current stable release; 2. the current
    development (CVS) release. Selecting either option will download the
    appropriate WURFL (to your DATADIR/dl_wurfl.xml) and install it into
    the database. It will also attempt to apply the WURFL patch file if
    patching is enabled. If an error occurs while updating the device
    table, the changes are automatically rolled back and no changes to
    you database will be made.
    b. Click on "Tera-WURFL test script" to test the installation. You can
    type in any user agent to search for in the WURFL. You can look
    at the source of that file to get an idea of how to use Tera-WURFL.
  6. Protect your 'admin' directory by using a method specific to your web
    server software. For Apache, a .htaccess file would work:
    http://www.elated.com/articles/password-protecting-your-pages-with-htaccess/

Example

Tera-WURFL is easy to use - just like PHP Tools! To get started, just take a look at the following code. This is an example of Tera-WURFL identifying the current visitor and displaying some information about their device in an appropriate markup language (either HTML, XHTML-MP or WML):

<?php
// include the configuration and the class file
require_once('./tera_wurfl_config.php');
require_once(
WURFL_CLASS_FILE);

// instantiate the class
$wurflObj = new tera_wurfl();

// get the capabilites from the user agent and take a look at the
// HTTP-ACCEPT headers in case the user agent is not found
$wurflObj->GetDeviceCapabilitiesFromAgent($_SERVER['HTTP_USER_AGENT'],true);
$cap = $wurflObj->capabilities;

// check if this device has an image associated with it
if($wurflObj->device_image != ""){
    
$image = '<p>Here is an image of your device: <br/><img src="'.$wurflObj->device_image.'" /></p><br />';
}else{
    
$image = "";
}

$devicename = $cap['product_info']['brand_name'] . " " . $cap['product_info']['model_name'];

// check if this device is mobile
if($cap['product_info']['is_wireless_device']){
    
// this IS a mobile device, let's see if it likes basic XHTML-MP
    
if($cap['markup']['html_wi_w3_xhtmlbasic'] ){
        
header("Content-Type: application/vnd.wap.xhtml+xml");
        echo
'<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Tera-WURFL Demo</title></head><body>'
;
        echo
"<p>This is XHTML-MP<br/>Your device: $devicename</p>$image";
        echo
"<pre>".print_r($cap['product_info'],true)."</pre>";
        echo
'</body></html>';
        exit;
    }else{
// looks like this device is old school - let's give it some wml
        
header("Content-Type: text/vnd.wap.wml");
        echo
'<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org//DTD//wml_1.1.xml">
<wml><card>'
;
        echo
"<p>This is WML<br/>Your device: $devicename</p>$image";
        echo
"<pre>".print_r($cap['product_info'],true)."</pre>";
        echo
'</card></wml>';
        exit;
    }
    
}else{
    
// this is NOT a mobile device - give it some HTML
    
echo "<html><head><title>Tera-WURFL Demo</title></head><body>";
    echo
"<p>This is HTML (your device is NOT mobile)<br/>Your device: $devicename</p>$image";
    echo
"<pre>".print_r($cap['product_info'],true)."</pre>";
    echo
"</body></html>";
    exit;
}
?>

You can also see this demo online. (or goto http://tera-wurfl.com/demo2.php on a mobile device)

Live Demonstrations

Demo #1: Tera-WURFL identifying over 100 devices in real time.
This demo churns through my database of unique user agents / http headers and attempts to identify every device. There is no caching mechanism in this release, so what you're seeing is real world performance.

Demo #2: Tera-WURFL Web Administration
This is the web administration page that comes with Tera-WURFL. It allows you to update the WURFL database over the Internet (or locally), update your database with your custom patch file and test your current configuration with manually entered user agents.

Demo #3: Tera-WURFL Manual Test Script
This script is very similar to the "check_wurfl.php" script used in the standard PHP Tools library, but it also includes an image of the identified device, if available.

Licencing

Tera-WURFL is distributed under the same licence as it's parent project, PHP Tools: Mozilla Public Licence (MPL) 1.1

Download

You can download Tera-WURFL from the Tera-WURFL Official Website.

 

Copyright © 2008, Luca Passani