forked from matomo-org/device-detector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
29 lines (21 loc) · 738 Bytes
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
* Device Detector - The Universal Device Detection library for parsing User Agents
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
*/
require __DIR__ . '/vendor/autoload.php';
use DeviceDetector\DeviceDetector;
use DeviceDetector\Parser\Device\DeviceParserAbstract;
if(isset($_GET['ua'])) {
$userAgent = $_GET['ua'];
} else {
$userAgent = $_SERVER['HTTP_USER_AGENT'];
}
DeviceParserAbstract::setVersionTruncation(DeviceParserAbstract::VERSION_TRUNCATION_NONE);
$result = DeviceDetector::getInfoFromUserAgent($userAgent);
echo '<form><input type="text" name="ua" /><input type="submit" /></form>';
echo "<pre>";
echo Spyc::YAMLDump($result, 2, 0);
echo "</pre>";