TeraWurflRemoteClient
[ class tree: TeraWurflRemoteClient ] [ index: TeraWurflRemoteClient ] [ all elements ]

Class: TeraWurflRemoteClient

Source Location: /TeraWurflRemoteClient/TeraWurflRemoteClient.php

Class Overview


Tera-WURFL remote webservice client for PHP


Variables

Methods



Class Details

[line 22]
Tera-WURFL remote webservice client for PHP



[ Top ]


Class Variables

static $FORMAT_JSON =  'json'

[line 34]

The JSON Data Format is the default transport for Tera-WURFL 2.1.2 and newer due to it's smaller size

and better performance with the builtin PHP functions




Tags:

access:  public

Type:   String


[ Top ]

static $FORMAT_XML =  'xml'

[line 28]

XML Data Format - this should only be used to communicate with Tera-WURFL 2.1.1 and older



Tags:

access:  public

Type:   String


[ Top ]

static $METHOD_CURL =  'curl'

[line 44]

PHP cURL Extension HTTP call method



Tags:

access:  public

Type:   String


[ Top ]

static $METHOD_URL_WRAPPER =  'urlwrap'

[line 39]

PHP URL Wrapper HTTP call method. If this is disabled on your server, you can use METHOD_CURL instead



Tags:

access:  public

Type:   String


[ Top ]

static $userAgentHeaders = array(
      'HTTP_X_DEVICE_USER_AGENT',
      'HTTP_X_ORIGINAL_USER_AGENT',
      'HTTP_X_OPERAMINI_PHONE_UA',
      'HTTP_X_SKYFIRE_PHONE',
      'HTTP_X_BOLT_PHONE_UA',
      'HTTP_USER_AGENT'
   )

[line 66]

The HTTP Headers that Tera-WURFL will look through to find the best User Agent, if one is not specified



Tags:

access:  public

Type:   Array


[ Top ]

$apiVersion =

[line 80]



Tags:

access:  protected

Type:   mixed


[ Top ]

$autolookup =  true

[line 50]

If you try to use a capability that has not been retrieved yet and this is set to true, it will generate another request to the webservice and retrieve this capability automatically.



Tags:

access:  public

Type:   Bool


[ Top ]

$capabilities = array()

[line 56]

Flattened version of Tera-WURFL's capabilities array, containing only capability names and values.

Since it is 'Flattened', there a no groups in this array, just individual capabilities.




Tags:

access:  public

Type:   Array


[ Top ]

$clientVersion =  '2.1.4'

[line 79]



Tags:

access:  protected

Type:   mixed


[ Top ]

$errors =

[line 61]

Array of errors that were encountered while processing the request and/or response.



Tags:

access:  public

Type:   Array


[ Top ]

$format =

[line 74]



Tags:

access:  protected

Type:   mixed


[ Top ]

$json =

[line 78]



Tags:

access:  protected

Type:   mixed


[ Top ]

$loadedDate =

[line 81]



Tags:

access:  protected

Type:   mixed


[ Top ]

$method =

[line 83]



Tags:

access:  protected

Type:   mixed


[ Top ]

$timeout =

[line 82]



Tags:

access:  protected

Type:   mixed


[ Top ]

$userAgent =

[line 75]



Tags:

access:  protected

Type:   mixed


[ Top ]

$webserviceUrl =

[line 76]



Tags:

access:  protected

Type:   mixed


[ Top ]

$xml =

[line 77]



Tags:

access:  protected

Type:   mixed


[ Top ]



Class Methods


static method getUserAgent [line 317]

static String getUserAgent( [string $source = null])

Return the requesting client's User Agent



Tags:

access:  public


Parameters:

string   $source  

[ Top ]

static method niceCast [line 292]

static String|Bool|Float niceCast( string $value)

Cast strings into proper variable types, i.e. 'true' into true



Tags:

access:  protected


Parameters:

string   $value  

[ Top ]

static method validURL [line 308]

static Bool validURL( string $url)

Is the given URL valid



Tags:

access:  protected


Parameters:

string   $url  

[ Top ]

constructor __construct [line 94]

TeraWurflRemoteClient __construct( String $TeraWurflWebserviceURL, [String $data_format = 'json'], [int $timeout = 1], [String $method = 'urlwrap'])

Creates a TeraWurflRemoteClient object. NOTE: in Tera-WURFL 2.1.2 the default data format is JSON.

This format is not supported in Tera-WURFL 2.1.1 or earlier, so if you must use this client with an earlier version of the server, set the second parameter to TeraWurflRemoteClient::$FORMAT_XML




Tags:

access:  public


Parameters:

String   $TeraWurflWebserviceURL   URL to the master Tera-WURFL Server's webservice.php
String   $data_format   TeraWurflRemoteClient::$FORMAT_JSON or TeraWurflRemoteClient::$FORMAT_XML
int   $timeout   Timeout in seconds
String   $method   HTTP Call Method (TeraWurflRemoteClient::$METHOD_URL_WRAPPER or TeraWurflRemoteClient::$METHOD_CURL)

[ Top ]

method callTeraWurfl [line 178]

void callTeraWurfl( String $uri)

Make the webservice call to the server using the GET method and load the response.



Tags:

access:  protected


Parameters:

String   $uri   The URI of the master server's webservice.php

[ Top ]

method getAPIVersion [line 162]

String getAPIVersion( )

Get the version of the Tera-WURFL Webservice (webservice.php on server). This is only available after a query has been made since it is returned in the response.



Tags:

access:  public


[ Top ]

method getCapabilitiesFromAgent [line 130]

bool getCapabilitiesFromAgent( String $userAgent, Array $capabilities)

Maintains backwards compatibility with Tera-WURFL <= 2.1.2. This function is an

alias for TeraWurflRemoteClient::getDeviceCapabilitiesFromAgent()




Tags:

return:  Success
access:  public


Parameters:

String   $userAgent   HTTP User Agent of the device being detected
Array   $capabilities   Array of capabilities that you would like to retrieve

[ Top ]

method getClientVersion [line 154]

String getClientVersion( )

Get the version of the Tera-WURFL Remote Client (this file)



Tags:

access:  public


[ Top ]

method getDeviceCapabilitiesFromAgent [line 111]

bool getDeviceCapabilitiesFromAgent( String $userAgent, Array $capabilities)

Get the requested capabilities from Tera-WURFL for the given user agent



Tags:

return:  Success
access:  public


Parameters:

String   $userAgent   HTTP User Agent of the device being detected
Array   $capabilities   Array of capabilities that you would like to retrieve

[ Top ]

method getDeviceCapability [line 138]

Mixed getDeviceCapability( String $capability)

Returns the value of the requested capability



Tags:

return:  String, Numeric, Bool
access:  public


Parameters:

String   $capability   The WURFL capability you are looking for (e.g. "is_wireless_device")

[ Top ]

method getLoadedDate [line 170]

String getLoadedDate( )

Get the date that the Tera-WURFL was last updated. This is only available after a query has been made since it is returned in the response.



Tags:

access:  public


[ Top ]

method loadCapabilities [line 251]

void loadCapabilities( )

Parse the response into the capabilities array



Tags:

access:  protected


[ Top ]

method loadErrors [line 274]

void loadErrors( )

Parse the response's errors into the errors array



Tags:

access:  protected


[ Top ]

method loadURL_cURL [line 236]

string loadURL_cURL( String $uri)

Makes the HTTP call to the remote Tera-WURFL Server using the PHP cURL Extension



Tags:

access:  protected


Parameters:

String   $uri   URL

[ Top ]

method loadURL_URLWrapper [line 219]

string loadURL_URLWrapper( String $uri)

Makes the HTTP call to the remote Tera-WURFL Server using PHP URL Wrappers



Tags:

return:  data
access:  protected


Parameters:

String   $uri   URL

[ Top ]


Documentation generated on Sat, 31 Mar 2012 15:45:11 -0400 by phpDocumentor 1.4.4