pepebe
8/21/2013 - 11:09 AM

Return detailed information about useragent.

Return detailed information about useragent.

<?php
/*
[[!useragentstring]]
Return detailed information about useragent using
a service provided by http://useragentstring.com
*/
$url = "http://useragentstring.com/?getJSON=all&uas=";
$user_agent = urlencode($_SERVER['HTTP_USER_AGENT']);

$apiquery= $url.$user_agent;

if (function_exists(file_get_contents)){
  $jsonText = file_get_contents($apiquery);
}

$obj = json_decode($jsonText, true);

<?php
$url = "http://useragentstring.com/?getJSON=all&uas=";
$user_agent = urlencode($_SERVER['HTTP_USER_AGENT']);

$apiquery= $url.$user_agent;

if (function_exists(file_get_contents)){
  $jsonText = file_get_contents($apiquery);
}

$obj = json_decode($jsonText, true);

return "<pre>" . print_r($obj,true) . "</pre>";