Fwd: [PHP-NOTES] note 100831 added to function.get-browser

From: Date: Wed, 10 Nov 2010 12:07:01 +0000
Subject: Fwd: [PHP-NOTES] note 100831 added to function.get-browser
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173896@lists.php.net to get a copy of this message
Besides the long code, this user adds a copyright to his snippet. We are supposed to delete these, right? Thiago Henrique Pojda +55 41 8856-7925 ---------- Forwarded message ---------- From: <arnel_milan@hotmail.com> Date: Wed, Nov 10, 2010 at 8:28 AM Subject: [PHP-NOTES] note 100831 added to function.get-browser To: php-notes@lists.php.net 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 -- PHP Notes Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.notes (#173896) next »