Not detecting iPhone 3

Integrating Tera-WURFL in your applications.

Not detecting iPhone 3

Postby scgroove » Thu Mar 29, 2012 4:10 pm

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/");

?>
scgroove
 
Posts: 3
Joined: Thu Mar 29, 2012 4:05 pm

Re: Not detecting iPhone 3

Postby kamermans » Sat Mar 31, 2012 1:15 pm

Hi,

Your code example is exactly right and should work just fine. Also, each user agent does not need to be present in order for matching to work properly - there are about 500,000 user agents on earth and only 18,000 in the WURFL database. The API's job is to map each user agent to an appropriate one in the database. If the API is throwing errors, then there is something else wrong. Can you download the latest WURFL file from wurfl.sourceforge.net and put it in the data/ directory, then do an update from the web interface (we released an update a few days ago)? This should solve your problem.
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Not detecting iPhone 3

Postby scgroove » Tue Apr 03, 2012 11:57 pm

Hi Steve. Thanks for responding. I have already tried that. I recently went to the source forge site and downloaded Tera-Wurfl.3.2.1.xml, or whatever the current version was. I then changed the name to wurfl.xml and uploaded it over my existing file. That’s where we are now.

For the most part everything seems configured correctly in my installation. It’s just like my database is incomplete because certain folks are reporting problems viewing the site from their iPhone 3s. I’ve also seem the error while simulating various user agents in Firefox. It works fine, however, on my iPhone 4S though. It directs me straight through to the mobile URL.

Maybe I'm just getting confused on how to update the wurfl file. You can't do it by clicking the link in the admin panel anymore, so I'm not sure where to turn. Or maybe as you suggest, the problem isn't even my database.

Sorry for my delayed response. I really appreciate your help.

Error:
Fatal error: Uncaught exception 'Exception' with message 'Error in DB RIS Query: PROCEDURE scgroove_tera_wurfl._RIS does not exist
scgroove
 
Posts: 3
Joined: Thu Mar 29, 2012 4:05 pm

Re: Not detecting iPhone 3

Postby kamermans » Wed Apr 04, 2012 10:08 am

Ah, sorry, I should have asked for the error message in the first place :). For some reason, the MySQL stored procedure that is used for matching is not present in your DB. This is either because the DB user doesn't have the required permissions for procedures (CREATE ROUTINE, ALTER ROUTINE, EXECUTE), or perhaps the database was copied from another location and the procedures were left behind, or perhaps you've changed the database user in your config file after loading the WURFL data, and the new user does not have permission to execute the old user's procedures. Whatever the case, assuming the user has the correct privileges, updating the DB should resolve the problem. You were correct in downloading the WURFL file and putting it in the data directory. You are also correct that the remote update function is not functional. What you'll need to do is an update from local, since you put the WURFL data in the local data/ directory. If you're working on the API anyway, you may be interested to know that a new, much improved version has been released in the last few days (version 1.4) and it is bundled with very current data and available for immediate download here: http://www.scientiamobile.com/downloads. There is also a getting started guide which has been updated/rewritten on that page.

If you continue to have this problem (PROCEDURE ... does not exist), then it's possible that your hosting provider does not support stored procedures for whatever reason, and you can change your Database Connector in the config from MySQL5 to MySQL4. The MySQL4 connector will work just fine on MySQ5, but it does not use stored procedures.
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Not detecting iPhone 3

Postby scgroove » Thu Apr 05, 2012 10:59 pm

Wow ... you honed in on that like you had a laser. Believe it or not, it was the last option. Apparently my host no speaka' the stored procedure. WOnder what's up with that. Probably an upgrade or something.

Anyway, thanks for your persistent help. Going to get the latest version now :-)
scgroove
 
Posts: 3
Joined: Thu Mar 29, 2012 4:05 pm


Return to Using Tera-WURFL

Who is online

Users browsing this forum: No registered users and 2 guests

cron