Receiving Capability Info from known User Agent?

Questions about the WURFL Cloud service.
djp120
Posts: 2
Joined: Tue Mar 06, 2012 1:35 pm

Receiving Capability Info from known User Agent?

Postby djp120 » Tue Mar 06, 2012 1:40 pm

Hi guys,

I've been through the code (to the best of my knowledge) and it appears I can set the HTTP GET request in the example files to include UA= my own agent.

It seems to recognising this ok. However, is returning the same web browser info. For example I am running

example.php?UA=Mozilla/5.0%20(iPhone;%20CPU%20iPhone%20OS%205_0_1%20like%20Mac%20OS%20X)%20AppleWebKit/534.46%20(KHTML,%20like%20Gecko)%20Version/5.1%20Mobile/9A405%20Safari/7534.48.3

However, it seems to be returning: generic web browser

What am i doing wrong?

All the best,

Dan

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: Receiving Capability Info from known User Agent?

Postby kamermans » Tue Mar 06, 2012 1:44 pm

The cloud clients use Cookie Caching by default, so it's likely that this response is being returned from cache. For testing you can specify the Null Cache provider. Which language are you using?
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: Receiving Capability Info from known User Agent?

Postby kamermans » Tue Mar 06, 2012 1:50 pm

I'm assuming you're using PHP. Here's an example of testing the client without caching and forcing a given user agent:

Code: Select all

<?php 
// Include the WURFL Cloud Client 
// You'll need to edit this path 
require_once '../Client/Client.php';
 
// Create a configuration object  
$config = new WurflCloud_Client_Config();  
 
// Set your WURFL Cloud API Key  
$config->api_key = 'xxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';   
 
// Create the WURFL Cloud Client  
$client = new WurflCloud_Client_Client($config, new WurflCloud_Cache_Null());  
 
// Detect your device  
$client->detectDevice(array('HTTP_USER_AGENT'=>'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7'));  
 
// Use the capabilities  
if ($client->getDeviceCapability('ux_full_desktop')) {  
    echo "This is a desktop web browser";  
} else {  
    echo "This is a mobile device";
} 
?>
Please note that I haven't tested this code, but it should be correct.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

djp120
Posts: 2
Joined: Tue Mar 06, 2012 1:35 pm

Re: Receiving Capability Info from known User Agent?

Postby djp120 » Tue Mar 06, 2012 2:13 pm

That worked a treat, thanks Steve.

Code: Select all

$client = new WurflCloud_Client_Client($config, new WurflCloud_Cache_Null()); 


Who is online

Users browsing this forum: No registered users and 25 guests