Parse User Agent String with API
UserAgent String Parser
The following provides a online PHP-based User Agent Parser, which will parse the UA-string into OS platform, the browser type and the browser version. You can just copy or enter the UA-string, press the Button. It will use Javascript Ajax to invoke the API, returning the parsed result in JSON format.
UserAgent String
In PHP, the global variable
$_SERVER['HTTP_USER_AGENT'] is a string that is sent by the browser, which defines various user information such as OS, browser and device. You could use the following API (no parameters) to return the current User-Agent string.
https://uploadbeta.com/api/user-agent/
It returns (in my case):
"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/51.0.2704.106 Safari\/537.36"
To parse the UA-string into a more readable format, you can use the following API. The API following has a
rate-limit 1 call per
second
https://uploadbeta.com/api/parse-user-agent/?cached&s=nUser-Agent:%20Mozilla/4.0%20(compatible;%20MSIE%207.0;%20Windows%20NT%205.1)
It will return:
{"platform":"Windows","browser":"MSIE","version":"7.0"}
If
$_GET parameter
s is not specified, this API will use the
$_POST variable
s instead.
curl -X POST https://uploadbeta.com/api/parse-user-agent/ -d "s=nUser-Agent:%20Mozilla/4.0%20(compatible;%20MSIE%207.0;%20Windows%20NT%205.1)"
Please note that if the parameter
s is missing, then the current User-Agent string is used (e.g. $_SERVER['HTTP_USER_AGENT']).
Example UA string
- Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER
- Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/6.0)
- JUC (Linux; U; 2.3.5; zh-cn; MEIZU MX; 640*960) UCWEB8.5.1.179/145/33232
- nUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
You can use the
getbrowser function in PHP to parse into readable formats as well.
API Servers
- Load Balancer: https://api.justyy.workers.dev/api/