| Replies
|
|
|
Macropiper
|
Posted at 11:19 pm on Jan. 21, 2009 |
| I would use regular expressions to extract the information out of the user agent, best place to start is by obtaining a nice long diverse list of user agents and keep working at the code till it processes them all perfectly. |
|
|
jkjslkjind
|
Posted at 11:39 pm on Dec. 30, 2008 |
| and if you wanna find browser if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE') !== false) echo 'Internet explorer'; remember, you must compare strpos to false. NOT to true. you can use ===false or !==false |
|
|
jkjslkjind
|
Posted at 11:37 pm on Dec. 30, 2008 |
| $_SERVER['HTTP_USER_AGENT'] try that :) |
|
|
pleaseremove
|
Posted at 3:24 pm on Dec. 30, 2008 |
Quote: from Mediocre at 10:34 pm on Dec. 30, 2008
I don't see how it's possible to determine browser/OS except through the user agent string.
Oh, i know this has to be done through the user agent, it is more than i need something human readable. I dont want it to spit back that i have Windows NT 6.0 or something, I want it to work out Vista. I guess im more looking for smart conversion tables than anything else. The feature is in PHP and there are even ways to get updates for such tables, but it is turned off in my install. |
|
|
Mediocre
|
Posted at 2:34 pm on Dec. 30, 2008 |
| I don't see how it's possible to determine browser/OS except through the user agent string. |
|
|
pleaseremove
|
Posted at 2:18 pm on Dec. 30, 2008 |
| It was looking good, but unfortunately it isn't quite what I am after. It doesn't do much more than reg ex the user agent. At current, when asking for browser and OS i am getting the following: Browser: Mozilla/Netscape 6.x OS: Microsoft Windows NT I am looking for something that actually figures out I have Vista and Firefox 3. |
|
|
Mediocre
|
Posted at 2:06 pm on Dec. 30, 2008 |
| Basically: | Code: | | require_once('Detect.php'); echo 'OS: '.Net_UserAgent_Detect::getOSString().'<br />Browser: '.Net_UserAgent_Detect::getBrowserString(); | |
|
|
pleaseremove
|
Posted at 1:56 pm on Dec. 30, 2008 |
Quote: from Mediocre at 9:34 pm on Dec. 30, 2008
PEAR has a popular package that does this: http://pear.php.net/package/Net_UserAgent_Detect/ Ugly code, but meh. 
That looks like exactly what I'm looking for. I don't suppose you have any experience in implementing this? As per usual Pear's documentation is very poor and I am having a hard time chasing docs after docs and not got it working as yet. |
|
|
Mediocre
|
Posted at 1:34 pm on Dec. 30, 2008 |
| PEAR has a popular package that does this: http://pear.php.net/package/Net_UserAgent_Detect/ Ugly code, but meh. |
|
|
adriannaa
|
Posted at 1:32 pm on Dec. 30, 2008 |
| Post from this position was omitted due to content violations |
|
|
All 10 previous replies displayed. |