I thought to share with you the code that detects real user agent
Demo: www.tinytop.mobi

<?php $real=$_SERVER['HTTP_X_OPERAMINI_PHONE_UA']; $real = strtok($real, "/"); $brow = $_SERVER['HTTP_USER_AGENT']; $brow = strtok($brow, "/"); if (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])){ $ua = $real; } else { $ua = $brow; }
function getoribrowser($_mob_browser){
if(preg_match('/(google|bot)/i',strtolower($_mob_browser))){
$position = strpos(strtolower($_mob_browser),"bot");
$_mob_browser = substr($_mob_browser, $position-30, $position+2);
$_browser = explode (" ", $_mob_browser);
$_browser = array_reverse($_browser);
}else if (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])) {
$_mob_browser = $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'];
$_position=strpos(strtolower($_mob_browser),"nokia");
if($_position)$_mob_browser = substr($_mob_browser, $_position,25);
$_browser = explode ("/", $_mob_browser);
}else {
$_position=strpos(strtolower($_mob_browser),"nokia");
if($_position)$_mob_browser = substr($_mob_browser, $_position,25);
$_browser = explode ("/", $_mob_browser);
}
return $_browser[0];
}
Comment