Detect real user agent 100%
Demo: http://tinytop.mobi
Demo: http://tinytop.mobi
function is_bot($user_agent) { //if no user agent is supplied then assume it's a bot if($user_agent == "") return 1; //array of bot strings to check for $bot_strings = Array( "google", "bot", "yahoo", "spider", "archiver", "curl", "python", "nambu", "twitt", "perl", "sphere", "PEAR", "java", "wordpress", "radian", "crawl", "yandex", "eventbox", "monitor", "mechanize", "facebookexternal" ); foreach($bot_strings as $bot) { if(strpos($user_agent,$bot) !== false) { return 1; } } return 0; }
function gum_real_ua() { //GET REAL DEVICE USER AGENT $keyname_ua_arr = array('HTTP_X_DEVICE_USER_AGENT', 'HTTP_X_OPERAMINI_PHONE_UA','HTTP_X_BOLT_PHONE_UA', 'HTTP_X_MOBILE_UA', 'HTTP_USER_AGENT'); foreach ($keyname_ua_arr as $keyname_ua) { if (!empty($_SERVER[$keyname_ua])) { return $_SERVER[$keyname_ua]; //REAL UA break; } } }
Comment