Greetings
I'm having what I believe to be 2 simple issues running Tera Wurfl to do basic browser detection and redirection. One, it doesn't appear to be possible to automatically update the devices any more, so I did it manually. Apparently a very popular user agent for the iPhone 3 isn't currently present in my database. So I need to understand how to add that agent to my database. This bring us to the second issue.
The problem seems to be, if I don’t have a ‘user agent string’ for the phone of the current visitor, then a PhP error is thrown. Until I can figure out how to continually update that database with new user agents, I have to come up with some kind of PHP script that can detect if a the user agent string in question is present in my MySql database, if it’s isn’t, instead of just throwing an error, I need it to redirect to my desktop site. I’m a PhP noob though, seems like I would need something like isFound(); to search the database?
Here’s what I’ve tried so far … to no avail. Thanks everyone.
<?php
require_once("Tera-WURFL/TeraWurfl.php");
$wurflObj = new TeraWurfl();
$wurflObj->getDeviceCapabilitiesFromAgent();
$isWireless = $wurflObj->getDeviceCapability("is_wireless_device");
if($wurflObj)
if($isWireless)
header ("location: http://www.savagepixels.com/mobile/");
else
header ("location: http://www.savagepixels.com/main/");
else
header ("location: http://www.savagepixels.com/main/");
?>