Browser Detection using PHP Browscap

Requirement

  • latest browscap.ini from Gary Keith’s site
  • download Jonathan Stoppani’s browscap.ini parser
  • create a folder called cache as Browscap.php will store information for quick access in the folder.

The Code

<?php
require('Browscap.php');

$bc = new Browscap('cache');
$bc->localFile = 'php_browscap.ini';

$data = $bc->getBrowser();
print_r($data);
?>

Finally, access $data as an object

echo $data->Browser;

Source taken from http://www.evanbot.com/article/php-browscap/19

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Print
  • StumbleUpon
  • Technorati
  • LinkedIn
  • Live
  • Tumblr
  • Add to favorites
  • MySpace
  • PDF
  • RSS
  • Twitter
  • Yahoo! Bookmarks

One Comment to “Browser Detection using PHP Browscap”

  1. nIc 5 May 2009 at 11:18 PM #

    Nice share! :)


Leave a Reply