Remote Webservice

From Tera-WURFL

Revision as of 12:52, 22 February 2010 by Kamermans (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

Tera-WURFL 2.1.1 introduced a full-featured webservice and remote client for many languages. Some reasons to use the remote webservice to query Tera-WURFL are:

Backend Files

TeraWurflWebservice.php

This file defines the TeraWurflWebservice class and provides the functionality to parse an incoming request, query Tera-WURFL and return the results in XML form.

webservice.php

The webservice.php file takes the raw request from the remote client and decodes it if necessary, then passes it to the TeraWurflWebService class for processing. The file then sends the response back to the client that requested it.

Frontend Files

TeraWurflRemoteClient.php

This file defines TeraWurflRemoteClient which is a stand-alone Tera-WURFL remote client (available from the TeraWurflRemoteClient/ folder. The TeraWurflRemoteClient has similar usage to the main Tera-WURFL library, as shown below.

require_once('../TeraWurflRemoteClient.php');
$wurflObj = new TeraWurflRemoteClient('http://localhost/Tera-Wurfl/webservice.php');
$capabilities = array("product_info","fake_capability");
$wurflObj->getCapabilitiesFromAgent(TeraWurflRemoteClient::getUserAgent(),$capabilities);                  
if($wurflObj->errors){
	foreach($wurflObj->errors as $name => $error){
		echo "$name: $error<br/>";
	}
}
Personal tools
Namespaces
Variants
Actions
WURFL DBAPI
Toolbox