Does this visitor's web site support CSS? Is this visitor a robot? Should I send out frames? There are the sorts of questions that you may want to ask in a PHP page .... and PHP supports the
get_browser function which can tell you ... or which can tell, most of the time, once you have it configured.
The
browscap.ini file that the function needs doe NOT ship with PHP. When you think about it, there's a certain logic to that as the browser database has to be updated far more frequently that PHP, so a separate distribution channel is sensible. Latest download from
http://browsers.garykeith.com/downloads.asp. Then you need to configure it into your PHP (i.e. tell your PHP where to find the file ... and I've done that on our server by adding the following line to the end of my php.ini file:
browscap = /home/wellho/include/browscap.ini
And then stopping and restarting httpd.
And
get_browser will now work. See it run at
http://www.wellho.net/demo/gbs.php and see the source code of my demonstration at
http://www.wellho.net/resources/ex.php4?item=h304/gbs.php.
Two more new browser type demos in PHP ... see
here for a sorted list of the browsers that people used for the first 1000 hits on our site yesterday, and
here for a demo that send out a graphic to a real user, but a descriptive alternative to a robot. That's a cheap and cheerful way of doing some of the things that I mention with get_browser and may be all you need. There are links to source on both of these examples.
(written 2009-04-22, updated 2009-04-28)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
W508 - Web and Intranet - Which Browser? [1519] Flipping images on your web page - (2008-01-26)
[3128] How does your browser find out about itself? - (2011-01-11)
H306 - PHP - Who is your visitor? [1736] Current visitors from around the world - PHP - (2008-08-04)
[2343] World Flags in your PHP pages - (2009-08-10)
[2380] Object Oriented programming - a practical design example - (2009-08-27)
[2667] Web page to telephone calls / links using an iPhone - (2010-03-08)
[3094] Setting your user_agent in PHP - telling back servers who you are - (2010-12-18)
[3946] Moving from a warning system to a control system - PHP, forum spammers - (2012-12-07)
H110 - PHP - HTML Web Page Data Handling [50] Current cost in your local currency - (2004-09-16)
[589] Robust PHP user inputs - (2006-02-03)
[789] Hot answers in PHP - (2006-07-02)
[896] PHP - good coding practise and sticky radio buttons - (2006-10-17)
[1001] .pdf files - upload via PHP, store in MySQL, retrieve - (2006-12-19)
[1053] Sorting people by name in PHP - (2007-01-26)
[1136] Buffering output - why it is done and issues raised in Tcl, Perl, Python and PHP - (2007-04-06)
[1169] Emailing as HTML (Web Page) - PHP example - (2007-04-30)
[1831] Text formating for HTML, with PHP - (2008-10-11)
[2025] Injection Attack if register_globals in on - PHP - (2009-02-04)
[2046] Finding variations on a surname - (2009-02-17)
[2107] How to tweet automatically from a blog - (2009-03-28)
[3036] Sending out an email containing HTML from within a PHP page - (2010-11-07)
[3926] Filtering PHP form inputs - three ways, but which should you use? - (2012-11-18)
Some other Articles
OS Commerce install made simpleSki bore ... train bore ... dog boreReaching the right people with your web siteWhat features does this visitors browser support? (PHP)Oracle take over Sun who had taken over MySQLBigger and better this year!Learning about LurchersPatterns in street namesJavascript - move cursor over image to change a different image.Nothing beats Perl to solve a data manipulation requirement quickly