get_browser() not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
William Manley
Forum Newbie
Posts: 4
Joined: Wed Jun 30, 2010 3:46 pm

get_browser() not working

Post by William Manley »

I am trying to use the get_browser() function but it is always returning the default variables.

[text]
[browscap]
; http://php.net/browscap
browscap = C:\wamp\bin\php\php5.3.0\php_browscap.ini[/text]

Despite configuring it according to all references I've found via Google, it is still not working. I obtained the database file from http://browsers.garykeith.com/downloads.asp and followed all directions on http://php.net/manual/en/function.get-browser.php.

I am using Firefox 3.6.6 on Windows XP SP3. The server is running Windows Server 2008 R2 with WAMP with Apache 2.1.11, PHP 5.3.0 and MySQL 5.1.36.

The output I receive is:

Code: Select all

Array
(
    [browser_name_regex] => §^.*$§
    [browser_name_pattern] => *
    [browser] => Default Browser
    [version] => 0
    [majorver] => 0
    [minorver] => 0
    [platform] => unknown
    [alpha] => 
    [beta] => 
    [win16] => 
    [win32] => 
    [win64] => 
    [frames] => 1
    [iframes] => 
    [tables] => 1
    [cookies] => 
    [backgroundsounds] => 
    [cdf] => 
    [vbscript] => 
    [javaapplets] => 
    [javascript] => 
    [activexcontrols] => 
    [isbanned] => 
    [ismobiledevice] => 
    [issyndicationreader] => 
    [crawler] => 
    [cssversion] => 0
    [supportscss] => 
    [aol] => 
    [aolversion] => 0
)
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: get_browser() not working

Post by Jonah Bron »

What do you see if you echo the value of $_SERVER['HTTP_USER_AGENT'] ?
William Manley
Forum Newbie
Posts: 4
Joined: Wed Jun 30, 2010 3:46 pm

Re: get_browser() not working

Post by William Manley »

I see my user agent as expected.

[text]Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6[/text]
aneesme
Forum Newbie
Posts: 9
Joined: Wed Jan 27, 2010 4:22 am
Location: Bangalore

Re: get_browser() not working

Post by aneesme »

Are you sure you restarted your web server?
William Manley
Forum Newbie
Posts: 4
Joined: Wed Jun 30, 2010 3:46 pm

Re: get_browser() not working

Post by William Manley »

Multiple times, yes. At first I restarted just the service. After that not working I restarted the entire server, making someone on the next floor not too happy :)
Post Reply