Remote Webservice

From Tera-WURFL

(Difference between revisions)
Jump to: navigation, search
(Created page with '==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: …')
(Introduction)
Line 2: Line 2:
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:
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:
* You want to share your Tera-WURFL database over multiple installations or servers, so you just install Tera-WURFL once in the '''backend''' and use the remote client on all the '''frontend''' servers (you only need one file for the remote client).
* You want to share your Tera-WURFL database over multiple installations or servers, so you just install Tera-WURFL once in the '''backend''' and use the remote client on all the '''frontend''' servers (you only need one file for the remote client).
-
* You want to query Tera-WURFL from a language other than PHP, like JavaScript, ActionScript 3, Perl, VBScript, .NET, ruby, etc...  Any language that can retrieve a remote file and parse it as XML can use the webservice.
+
* You want to query Tera-WURFL from a language other than PHP, like JavaScript, ActionScript 3, Perl, Python, VBScript, .NET, ruby, etc...  Any language that can retrieve a remote file and parse it as XML can use the webservice.
* You want to provide managed mobile device detection capabilities to your customers without giving them access to the Tera-WURFL library itself.
* You want to provide managed mobile device detection capabilities to your customers without giving them access to the Tera-WURFL library itself.

Revision as of 10:51, 24 February 2010

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