get_browser() directive not set

get_browser() directive not set

Posted by: htmlgraphic
Posted on: 2007-06-08 00:14:00

Hello All,

I have a site that needs to use php's great function that can detect the browser version. get_browser(); What do I have to do to get this working correctly?

Error message:
Warning: get_browser() [function.get-browser]: browscap ini directive not set.

Thanks in advance.

PHP get_browser() directive not set

Posted by: htmlgraphic
Posted on: 2007-06-10 09:07:00

I have a site that needs to use php's great function that can detect the browser version. get_browser(); What do I have to do to get this working correctly with in my histing account?

Error message:
Warning: get_browser() [function.get-browser]: browscap ini directive not set.

Thanks in advance.

Re: PHP get_browser() directive not set

Posted by: scjessey
Posted on: 2007-06-10 11:38:00

I'm getting this weird feeling of déjà vu.

Re: PHP get_browser() directive not set

Posted by: pangea33
Posted on: 2007-06-11 20:32:00

Since browser details are client-side information, I'd recommend using javascript since that php function isn't available. Google is a good resource for this sort of question too.

http://javascript.internet.com/user-details/browser-properties.html
http://javascript.internet.com/user-details/browser-info.html
http://javascript.internet.com/user-details/browser-details.html

http://www.google.com/search?hl=en&q=javascript+get+browser+details&btnG=Google+Search

Re: PHP get_browser() directive not set

Posted by: htmlgraphic
Posted on: 2007-08-02 20:22:00

Thanks for your reply. Actually there is a great universal script, updated almost daily with new browser / client information and a built in PHP function that can be used to get client side information asp or php. I like this better because it works directly with server side scripting and reduces client side scripting (load time). If you need to have it setup on a per site basis use this code.

<?php
if (get_cfg_var('browscap'))
$browser = get_browser(null, true); //If available, use PHP native function
else
{
require_once($_SERVER['DOCUMENT_ROOT']."/includes/php-local-browscap.php");
$browser=get_browser_local(null, true);
}
print_r($browser);
?>

More information can be found at this great website.
http://browsers.garykeith.com/downloads.asp


Re: PHP get_browser() directive not set

Posted by: netdcon
Posted on: 2007-08-03 07:47:00

I use Gary's info - it's great.

However, in order to use his PHP browscap files you'll need to compile your own PHP and appropriately change the "browscap=" directive in your php.ini file.

Re: PHP get_browser() directive not set

Posted by: htmlgraphic
Posted on: 2007-08-03 07:51:00

You do not need to compile your own PHP there is a great standalone version. For details follow the information below.

Standalone version of get_browser() in PHP
http://www.php.net/manual/function.get-browser.php
Detection of the capacities of a Web browser client. Requires a compatible browscap.ini database, such as php_browscap.ini on
http://browsers.garykeith.com/downloads.asp

Tags: thanks in advanceerror message