PHP Classes

Not Run

Recommend this page to a friend!

      PHP User Agent Parser class  >  All threads  >  Not Run  >  (Un) Subscribe thread alerts  
Subject:Not Run
Summary:Not Run
Messages:3
Author:BratSadLove
Date:2015-05-23 01:07:05
 

  1. Not Run   Reply   Report abuse  
Picture of BratSadLove BratSadLove - 2015-05-23 01:07:05
Hi !

I try it:

include('parseUserAgentString.php');
$parser = new parseUserAgentStringClass(); // This creates a new instance of this class object.
$parser->includeAndroidName = true;
$parser->includeWindowsName = true;
$parser->includeMacOSName = true;
$parser->treatClonesAsTheRealThing = true;
$parser->treatProjectSpartanInternetExplorerLikeLegacyInternetExplorer = false;
$parser->parseUserAgentString("[Your User Agent String Goes Here]"); // This calls the parser function in the class object.

echo $parser->type;

But not run, i run on chrome win7

Thank's

  2. Re: Not Run   Reply   Report abuse  
Picture of Tom Parkison Tom Parkison - 2015-05-23 02:25:14 - In reply to message 1 from BratSadLove
Read the documentation again. The usage of the Class is all in the documentation. More than likely the script isn't detecting your browser correctly. If you can send me your User Agent String I will look into why the script isn't identifying it.

  3. Re: Not Run   Reply   Report abuse  
Picture of Dave Smith Dave Smith - 2015-05-23 03:31:49 - In reply to message 1 from BratSadLove
I just tested it on Win 7 with Chrome and it worked fine for me.

Maker sure you replace the text...

[Your User Agent String Goes Here]

with a user agent string, try...

$parser->parseUserAgentString($_SERVER['HTTP_USER_AGENT']);

You also need to display something, like this...

if ($parser->knownbrowser) {

echo $parser->browsername.'<br>';
echo $parser->osname.'<br>';
echo $parser->browserversion.'<br>';
echo $parser->type.'<br>';
}
else {
echo 'Unknown Browser';
}


Dave