Check String and User Agent

Check String and User Agent

This is what i do to check out that stuff:

if(strlen(strstr($_SERVER['HTTP_USER_AGENT'],"Firefox")) <= 0 ){ // if not firefox

//do something

}

And added into your code:

function get_user_browser()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$ub = '';
if(strlen(strstr($u_agent,"Firefox")) > 0 ){

$ub = 'firefox';

}
else {
$ub = 'other';
}

return $ub;
}

if (isset($_GET['print']) && $_GET['print'] != ""
&& get_user_browser() == 'firefox')
{
$pg = $_GET['print'];
if (!file_exists('1'))
{
echo '<b>It worked!</b>';
}
}
else
{
echo '';
}

Detecting the users browser with the User Agent String

You may try to check this Browser detection using the user agent

The most common reason to perform user agent sniffing is to determine
which type of device the browser runs on.

UserAgent String information for knowing the plugins or extensions installed on the requesting browser?

I found this site.

It has many user agents. I went through many Useragents and finally I could see that in older browser versions of IE and Opera the name of the plugins/extensions were present.

In Chrome and Firefox I could not find any such imprints.

How to retrieve exact user-agent string from Google Analytics

The best you're going to get out of the Data Export API (or the Google Analytics interface) is processed information: browser / browser version (Internet Explorer / 8.0). There is no way to get the original user-agent string.

Also note that if you have a high volume website you're going to run into data sampling especially if you're looking at a date range beyond larger than a day or two (more on sampling).



Related Topics



Leave a reply



Submit