PHP code example of mhmmdq / useragent
1. Go to this page and download the library: Download mhmmdq/useragent library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mhmmdq / useragent example snippets
hmmdq\Useragent\UserAgent;
$useragent = UserAgent::analyze();
var_dump($useragent);
$useragent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36';
var_dump(UserAgent::analyze($useragent));
UserAgent::is_mobile();
if(UserAgent::is_mobile()) {
header('location: https://m.example.com');
}
UserAgent::lang();