Welcome Guest, Not a member yet? Register   Sign In
user agent class problem
#1

[eluser]NachoF[/eluser]
When accessing from a Blackberry browser:
Code:
$this->agent->is_mobile()
returns true
but
Code:
$this->agent->browser()
returns empty string
so does this
Code:
$this->agent->version()
.....
Code:
$this->agent->agent_string()
returns the agent string correctly so theres got to be something wrong in retrieving the browser and the version from the string... dont know how to fix it though.
#2

[eluser]Kepler[/eluser]
You need to add the blackberry User Agent information into:

config/user_agents.php

You will see different associated arrays with 'pattern' => 'value'

You are not getting any values back now because the none of the default 'pattern's are matching anything in the blackberry's user agent string.
#3

[eluser]NachoF[/eluser]
Sorry, I dont quite understand... what exactly do I need to add to the user_agents.php file??... i noticed blackberry was commented out so i uncommented it but the behaviour I explained remains the same.
#4

[eluser]Kepler[/eluser]
First of all you need to know what HTTP_USER_AGENT your blackberry is sending. You can detect this by creating a php page on your server that contains only:

Code:
<?php phpinfo(); ?>

Bring up this page on your blackberry and look for HTTP_USER_AGENT. I don't have a blackberry so I don't know what the string looks like. A quick search on the web says that there should be "BlackBerry" in the string. This should be your pattern. Make sure to use some substring that uniquely identifies your browser/platform.

Now add:

Code:
$platforms = array (
...
                    'BlackBerry'        => 'BlackBerry OS' // I am not sure what OS BlackBerry uses.
                );


$browsers = array(
...
                    'BlackBerry'        => 'BlackBerry browser' // again, I am not sure what browser the BlackBerry uses.
                );

$mobiles = array(
...
                    'BlackBerry'        => 'BlackBerry'
                );

I recommend doing some research so you know what OS / browser this device uses. The right-hand side values should match the correct browser / OS so your logic takes the correct action.
#5

[eluser]NachoF[/eluser]
the user agent string according to
Code:
$this->agent->agent_string();
is
Quote:BlackBerry8320/4.5.0.55 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/-1

I would like
Code:
echo "You are browsing with a ".$this->agent->browser()." version".$this->agent->version();
to print out
Quote:You are browsing with a BlackBerry Browser version 4.5.0.55
Do you think thats possible?
#6

[eluser]NachoF[/eluser]
I did the changes you told me to and now its printing
Quote:You are browsing with a BlackBerry Browser version 8320
Where do I change that so that it says 4.5.0.55??




Theme © iAndrew 2016 - Forum software by © MyBB