Return to site

How To Get Browser

broken image
Php get browser type
Follow up to Francesco R's post from 2016.
His function works for most human traffic; added a few lines to cover the most common bot traffic. Also fixed issue with function failing to detect strings at position 0 due to strpos behavior.
// Function written and tested December, 2018
function get_browser_name($user_agent)
{
// Make case insensitive.
$t = strtolower($user_agent);
// If the string *starts* with the string, strpos returns 0 (i.e., FALSE). Do a ghetto hack and start with a space.
// '[strpos()] may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE.'
// http://php.net/manual/en/function.strpos.php
$t = ' ' . $t;
// Humans / Regular Users
if (strpos($t, 'opera' ) || strpos($t, 'opr/') ) return 'Opera' ;
elseif (
strpos($t, 'edge' ) ) return 'Edge' ;
elseif (
strpos($t, 'chrome' ) ) return 'Chrome' ;
elseif (
strpos($t, 'safari' ) ) return 'Safari' ;
elseif (
strpos($t, 'firefox' ) ) return 'Firefox' ;
elseif (
strpos($t, 'msie' ) || strpos($t, 'trident/7')) return 'Internet Explorer';
// Search Engines
elseif (strpos($t, 'google' ) ) return '[Bot] Googlebot' ;
elseif (
strpos($t, 'bing' ) ) return '[Bot] Bingbot' ;
elseif (
strpos($t, 'slurp' ) ) return '[Bot] Yahoo! Slurp';
elseif (
strpos($t, 'duckduckgo') ) return '[Bot] DuckDuckBot' ;
elseif (
strpos($t, 'baidu' ) ) return '[Bot] Baidu' ;
elseif (
strpos($t, 'yandex' ) ) return '[Bot] Yandex' ;
elseif (
strpos($t, 'sogou' ) ) return '[Bot] Sogou' ;
elseif (
strpos($t, 'exabot' ) ) return '[Bot] Exabot' ;
elseif (
strpos($t, 'msn' ) ) return '[Bot] MSN' ;
// Common Tools and Bots
elseif (strpos($t, 'mj12bot' ) ) return '[Bot] Majestic' ;
elseif (
strpos($t, 'ahrefs' ) ) return '[Bot] Ahrefs' ;
elseif (
strpos($t, 'semrush' ) ) return '[Bot] SEMRush' ;
elseif (
strpos($t, 'rogerbot' ) || strpos($t, 'dotbot') ) return '[Bot] Moz or OpenSiteExplorer';
elseif (
strpos($t, 'frog' ) || strpos($t, 'screaming')) return '[Bot] Screaming Frog';
// Miscellaneous
elseif (strpos($t, 'facebook' ) ) return '[Bot] Facebook' ;
elseif (
strpos($t, 'pinterest' ) ) return '[Bot] Pinterest' ;
// Check for strings commonly used in bot user agents
elseif (strpos($t, 'crawler' ) || strpos($t, 'api' ) ||
strpos($t, 'spider' ) || strpos($t, 'http' ) ||
strpos($t, 'bot' ) || strpos($t, 'archive') ||
strpos($t, 'info' ) || strpos($t, 'data' ) ) return '[Bot] Other' ;
return
'Other (Unknown)';
}
?>
Post with more depth here:
https://www.256kilobytes.com/content/show/1922/how-to-parse-a-user-agent-in-php-with-minimal-effort
  1. Internet Browser privacy policy Terms of transaction Internet Browser license terms This application is designed to download/share legal content. The responsibility lies upon the user to not spread malicious, false or illegal materials. App features are provided as is.
  2. At the bottom, under 'Web browser', click your current browser (typically Microsoft Edge). In the 'Choose an app' window, click Google Chrome. To easily open Chrome later, add a shortcut to your taskbar: On your computer, open Chrome. In the Windows taskbar at.

How To Get Browser Menu

How can i view snapchat on my computer. At the bottom of the window, check the 'Set Google Chrome as my default browser' if you want Chrome to be your default browser. Finally, click 'Accept and install' at the bottom-right of the window. Google Chrome will now download and install to your computer.





broken image