note 100831 added to function.get-browser

From: Date: Wed, 10 Nov 2010 10:28:54 +0000
Subject: note 100831 added to function.get-browser
Groups: php.notes 
Request: Send a blank email to php-notes+get-173895@lists.php.net to get a copy of this message
For all shared hosting users: 1. Using htaccess to trigger the browscap will not work. This is one of the limitation of htaccess for setting a customized php variables. 2. One of the best solution is the "PHPBROWSCAP" class which can be downloaded here https://github.com/garetjax/phpbrowscap 3. It maybe tricky but the code will simply work by using the http://code.google.com/p/phpbrowscap/wiki/QuickStart 4. The key to make that class work is to create a "cache" folder and make it writable. Below are the codes : /** * @author ARNEL MILAN * @copyright 2010 */ $agent = $_SERVER['HTTP_USER_AGENT']; require ("lib/browscap.php"); // Creates a new Browscap object (loads or creates the cache) $bc = new Browscap('cache'); // Create this folder // Gets information about the current browser's user agent $current_browser = $bc->getBrowser($agent); // Output the result echo '<pre>'; // some formatting issues ;) print_r($current_browser); echo '</pre>'; Hope this help! ---- Server IP: 69.147.83.197 Probable Submitter: 202.73.169.91 ---- Manual Page -- http://www.php.net/manual/en/function.get-browser.php Edit -- https://master.php.net/note/edit/100831 Del: integrated -- https://master.php.net/note/delete/100831/integrated Del: useless -- https://master.php.net/note/delete/100831/useless Del: bad code -- https://master.php.net/note/delete/100831/bad+code Del: spam -- https://master.php.net/note/delete/100831/spam Del: non-english -- https://master.php.net/note/delete/100831/non-english Del: in docs -- https://master.php.net/note/delete/100831/in+docs Del: other reasons-- https://master.php.net/note/delete/100831 Reject -- https://master.php.net/note/reject/100831 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#173895) next »