방문자의 브라우저와 OS등을 가져 오는 클레스
페이지 정보
작성자 MintState 댓글 0건 조회 18,629회 작성일 10-07-02 12:29본문
방문자의 브라우저와 OS등을 가져 오는 클레스
$_SERVER['HTTP_USER_AGENT'] 를 간단히 분석합니다. 깔끔하네요.
User Agent string is a characteristic identification text which is submitted by web browsers, bots and other applications which use World Wide Web.
In PHP you can get this from $_SERVER['HTTP_USER_AGENT'] variable.
Using this variable you cannot identify a web browser with 100% accuracy as this string might be quite easily altered by a web browser user. However modifying UAS is not something most people do
The code I post here is not perfect, but it can detect browser and operating system in most cases.
I have tested it against over 1000 User Agent Strings and it successfully detected more than 99%.
Here’s a list of some of the user agents this class can detect:
Firefox, Opera, Chrome, Internet Explorer (MSIE), Konqueror, Opera, boxee, Mediapartners-Google, Googlebot, Wget, W3C_Validator, Netscape, Yahoo! Slurp, Safari, Songbird, Xiino, ACS-NF, abot, Ace Explorer, ActiveBookmark, AIM, amaya, Iceweasel, AmigaVoyager, Arexx, ANTFresco, aolbrowser, Astra, Avantgo, Crazy, curl, Dillo, ELinks, FlashGet, IEMobile, ia_archiver, iCab, Links, Lynx, MobileExplorer, Blazer, NetFront,Mozilla, WebPro, ANTGalio, heritrix, iCab, ABrowse, OmniWeb, lolifox, Navigator, SeaMonkey, Camino, Shiira, Sunrise, Flock, Minimo, K-Meleon.
It can even detect Internet Explorer wrappers (application which use Internet Explorer ActiveX) like
Sleipnir, Avant Browser, MyIE2, Embedded Web Browsser, TheWorld, Maxthon or Browzar. You can find this information in $res['wrapper'];
If user agent is detected as bot, $res['bot'] will be set to true.
The license, as usual, is MIT, so you can use for private & commercial projects.
OutPut
$_SERVER['HTTP_USER_AGENT'] 를 간단히 분석합니다. 깔끔하네요.
User Agent string is a characteristic identification text which is submitted by web browsers, bots and other applications which use World Wide Web.
In PHP you can get this from $_SERVER['HTTP_USER_AGENT'] variable.
Using this variable you cannot identify a web browser with 100% accuracy as this string might be quite easily altered by a web browser user. However modifying UAS is not something most people do
The code I post here is not perfect, but it can detect browser and operating system in most cases.
I have tested it against over 1000 User Agent Strings and it successfully detected more than 99%.
Here’s a list of some of the user agents this class can detect:
Firefox, Opera, Chrome, Internet Explorer (MSIE), Konqueror, Opera, boxee, Mediapartners-Google, Googlebot, Wget, W3C_Validator, Netscape, Yahoo! Slurp, Safari, Songbird, Xiino, ACS-NF, abot, Ace Explorer, ActiveBookmark, AIM, amaya, Iceweasel, AmigaVoyager, Arexx, ANTFresco, aolbrowser, Astra, Avantgo, Crazy, curl, Dillo, ELinks, FlashGet, IEMobile, ia_archiver, iCab, Links, Lynx, MobileExplorer, Blazer, NetFront,Mozilla, WebPro, ANTGalio, heritrix, iCab, ABrowse, OmniWeb, lolifox, Navigator, SeaMonkey, Camino, Shiira, Sunrise, Flock, Minimo, K-Meleon.
It can even detect Internet Explorer wrappers (application which use Internet Explorer ActiveX) like
Sleipnir, Avant Browser, MyIE2, Embedded Web Browsser, TheWorld, Maxthon or Browzar. You can find this information in $res['wrapper'];
If user agent is detected as bot, $res['bot'] will be set to true.
The license, as usual, is MIT, so you can use for private & commercial projects.
include 'UserAgent.php'; $userAgent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)'; $u = new UserAgent(); $res = $u->detect($userAgent); print_r($res);
OutPut
|
댓글목록
등록된 댓글이 없습니다.