|
1 |
| -# Udger client for PHP |
| 1 | +# Udger client for PHP (data ver. 3) |
2 | 2 | Local parser is very fast and accurate useragent string detection solution. Enables developers to locally install and integrate a highly-scalable product.
|
3 | 3 | We provide the detection of the devices (personal computer, tablet, Smart TV, Game console etc.), operating system and client SW type (browser, e-mail client etc.).
|
| 4 | +It also provides information about IP addresses (Public proxies, VPN services, Tor exit nodes, Fake crawlers, Web scrapers .. etc.) |
| 5 | + |
| 6 | +- Tested with more the 50.000 unique user agents. |
| 7 | +- Up to date data provided by https://udger.com/ |
4 | 8 |
|
5 | 9 | ### Requirements
|
6 | 10 | - php >= 5.3.0
|
7 | 11 | - ext-sqlite3 (http://php.net/manual/en/book.sqlite3.php)
|
8 | 12 |
|
9 | 13 | ### Features
|
10 | 14 | - Fast
|
11 |
| -- Standalone |
12 |
| -- Auto updated datafile and cache from remote server with version checking and checksum datafile |
13 | 15 | - Released under the GNU (LGPL v.3)
|
14 | 16 |
|
15 | 17 | ### Install
|
16 | 18 |
|
17 | 19 | composer install
|
18 | 20 |
|
19 | 21 | ### Usage
|
20 |
| -You should review the included examples (`parse.php`, `isbot.php`, `account.php`, `manual_update_data.php` or `full_example.php`) |
| 22 | +You should review the included examples (`parse.php`, `account.php`) |
21 | 23 |
|
22 | 24 | Here's a quick example:
|
23 | 25 |
|
24 | 26 | ```php
|
25 |
| -require_once __DIR__ . '/vendor/autoload.php'; |
26 |
| -$parser = new Udger\Parser(); |
27 |
| -$parser->setDataDir(sys_get_temp_dir() . "/udgercache/"); |
28 |
| -$parser->setAccessKey('XXXXXX'); |
29 |
| -$ret = $parser->parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36'); |
| 27 | +require_once dirname(__DIR__) . '/vendor/autoload.php'; |
| 28 | +$factory = new Udger\ParserFactory(); |
| 29 | +$parser = $factory->getParser(); |
| 30 | +$parser->setDataFile(sys_get_temp_dir() . "/udgercache/udgerdb_v3.dat"); |
| 31 | +$parser->setUA('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36'); |
| 32 | +$parser->setIP("2A02:598:7000:116:0:0:0:101"); |
| 33 | +$ret = $parser->parse(); |
30 | 34 | echo "<pre>";
|
31 | 35 | print_r($ret);
|
32 | 36 | echo "</pre>";
|
| 37 | + |
| 38 | + |
| 39 | +Array |
| 40 | +( |
| 41 | + [user_agent] => Array |
| 42 | + ( |
| 43 | + [ua_string] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36 |
| 44 | + [ua_class] => Browser |
| 45 | + [ua_class_code] => browser |
| 46 | + [ua] => Chrome 48.0.2564.97 |
| 47 | + [ua_version] => 48.0.2564.97 |
| 48 | + [ua_version_major] => 48 |
| 49 | + [ua_uptodate_current_version] => 48 |
| 50 | + [ua_family] => Chrome |
| 51 | + [ua_family_code] => chrome |
| 52 | + [ua_family_homepage] => http://www.google.com/chrome/ |
| 53 | + [ua_family_vendor] => Google Inc. |
| 54 | + [ua_family_vendor_code] => google_inc |
| 55 | + [ua_family_vendor_homepage] => https://www.google.com/about/company/ |
| 56 | + [ua_family_icon] => chrome.png |
| 57 | + [ua_family_icon_big] => chrome_big.png |
| 58 | + [ua_family_info_url] => https://udger.com/resources/ua-list/browser-detail?browser=Chrome |
| 59 | + [ua_engine] => WebKit/Blink |
| 60 | + [os] => Windows 7 |
| 61 | + [os_code] => windows_7 |
| 62 | + [os_homepage] => https://en.wikipedia.org/wiki/Windows_7 |
| 63 | + [os_icon] => windows-7.png |
| 64 | + [os_icon_big] => windows-7_big.png |
| 65 | + [os_info_url] => https://udger.com/resources/ua-list/os-detail?os=Windows 7 |
| 66 | + [os_family] => Windows |
| 67 | + [os_family_code] => windows |
| 68 | + [os_family_vendor] => Microsoft Corporation. |
| 69 | + [os_family_vendor_code] => microsoft_corporation |
| 70 | + [os_family_vendor_homepage] => https://www.microsoft.com/about/ |
| 71 | + [device_class] => Desktop |
| 72 | + [device_class_code] => desktop |
| 73 | + [device_class_icon] => desktop.png |
| 74 | + [device_class_icon_big] => desktop_big.png |
| 75 | + [device_class_info_url] => https://udger.com/resources/ua-list/device-detail?device=Desktop |
| 76 | + [crawler_last_seen] => |
| 77 | + [crawler_category] => |
| 78 | + [crawler_category_code] => |
| 79 | + [crawler_respect_robotstxt] => |
| 80 | + ) |
| 81 | + |
| 82 | + [ip_address] => Array |
| 83 | + ( |
| 84 | + [ip] => 2A02:598:7000:116:0:0:0:101 |
| 85 | + [ip_ver] => 6 |
| 86 | + [ip_classification] => Crawler |
| 87 | + [ip_classification_code] => crawler |
| 88 | + [ip_hostname] => |
| 89 | + [ip_last_seen] => 2016-02-12 04:28:56 |
| 90 | + [ip_country] => Czech Republic |
| 91 | + [ip_country_code] => CZ |
| 92 | + [ip_city] => Prague |
| 93 | + [crawler_name] => SeznamBot/3.2-test1 |
| 94 | + [crawler_ver] => 3.2-test1 |
| 95 | + [crawler_ver_major] => 3 |
| 96 | + [crawler_family] => SeznamBot |
| 97 | + [crawler_family_code] => seznambot |
| 98 | + [crawler_family_homepage] => http://napoveda.seznam.cz/cz/seznambot.html |
| 99 | + [crawler_family_vendor] => Seznam.cz, a.s. |
| 100 | + [crawler_family_vendor_code] => seznam-cz_as |
| 101 | + [crawler_family_vendor_homepage] => http://www.seznam.cz/ |
| 102 | + [crawler_family_icon] => seznam.png |
| 103 | + [crawler_family_info_url] => https://udger.com/resources/ua-list/bot-detail?bot=SeznamBot#id12590 |
| 104 | + [crawler_last_seen] => 2016-02-15 06:12:28 |
| 105 | + [crawler_category] => Search engine bot |
| 106 | + [crawler_category_code] => search_engine_bot |
| 107 | + [crawler_respect_robotstxt] => unknown |
| 108 | + [datacenter_name] => |
| 109 | + [datacenter_name_code] => |
| 110 | + [datacenter_homepage] => |
| 111 | + ) |
| 112 | + |
| 113 | +) |
33 | 114 | ```
|
34 | 115 |
|
35 |
| -### Running tests |
36 | 116 |
|
| 117 | + |
| 118 | +### Running tests |
37 | 119 | ./vendor/bin/codecept run
|
38 | 120 |
|
39 |
| -### Data for parser |
40 |
| -- info: https://udger.com/download/data |
| 121 | +### Automatic updates download |
| 122 | +- for autoupdate data use Udger data updater (https://udger.com/support/documentation/?doc=62) |
41 | 123 |
|
42 | 124 | ### Author
|
43 |
| -The Udger.com Team ( [email protected]) |
| 125 | +- The Udger.com Team ( [email protected]) |
| 126 | + |
| 127 | +### old v2 format |
| 128 | +If you still use the previous format of the db (v2), please see the branch old_format_v2 |
0 commit comments