Entry
Is there anyway to get php to grab the browser brand that is pulling the page eg IE or Netscape?
Jan 13th, 2002 16:16
Jens Clasen, dog dog, http://sourceforge.net/project/showfiles.php?group_id=26044
There are several posibilities to find out which browser currently
requests Your page:
1. You could use Javascript and test for several abilities to determine
the User-Agent.
2. Or You could use get_browser() which will return an object with lots
of information regarding the User-Agent.
If You for example want to know the browsers manufacturer, You could
use this:
<?php
# NOTE:
# -----
# You will need a current browscap.ini to run this example!
$browser_info=get_browser();
if(!empty($browser_info))
echo $browser_info->browser;
else
echo "Unable to determine Your User-Agent...";
?>
3. If You just need the Brand of a browser, the best way in my Opinion
is to evaluate the $HTTP_USER_AGENT using Reg-Expressions.
The best thing I've seen so far for that purpose is Roger Raymond's
Sniffer-Class published at Sourceforge's (Check the Link above), so
if You wan't to know how it works I encourage You to check out his
Sources!
P.S.: As always: Please excuse my bad English - it's not my native
Language