how to use browsercap.ini in PHP
how to detect browser (http user agent) in php


download first brosercap.ini from http://browsers.garykeith.com/downloads.asp
and
from http://alexandre.alapetite.net/doc-alex/php-local-browscap/index.en.html download
the php-local-browscap module

download source code a save it for example to dir ./lib/php_browscap.ini
and to index.php paste following code


echo $_SERVER[HTTP_USER_AGENT];
if (get_cfg_var('browscap'))
 $browser=get_browser(); //If available, use PHP native function
else
{
 include_once('lib/php_local_browscap.php');
 $browser=get_browser_local($user_agent=null,$return_array=false,$db='lib/php_browscap.ini',$cache=false);
}
echo('
');
print_r($browser);
echo('

');
?>

that’s all

more about this http://www.php.net/manual/en/function.get-browser.php

Sdílejte:
  • Facebook
  • Add to favorites
  • Twitter
  • del.icio.us
  • Digg
  • LinkedIn
  • Google Bookmarks
  • email
  • Print
Tags: ,
Leave a Reply