Solved

Browser and OS detection

Posted on 2006-07-12
7
1,173 Views
Last Modified: 2008-02-01
Hi guys.

I'm required to create a detailed script which will detect the users browser and general pc settings and i would greatly appriciate any advise and code snippets what you may be able to share with me.

I'm developing in PHP.

I'm trying to detect the following in relation to Broswers:
Browser Name (pretty straight forward)
Browser Version (straight forward)
Brower Plugins
Flash Version
Screen Resolution (i have done this already)
If cookies are enabled/disabled
If Javascript is enabled
(Any other important browser setting that i should attempt to detect that you may suggest?)

I'm just using:
[php]
<?php echo $_SERVER['HTTP_USER_AGENT']; ?>
<?php print "IP: ". $_SERVER ['REMOTE_ADDR']; ?>
[/php]
To detect the browser name and the IP address at the moment. Is there a better method of detecting either of these? Would that code be able to detect IP addresses behind a proxy?

Operating System:
What manufacturer
What version
What service pack

Some long shots! Is it possible to detect the Make and Model of the Router been used via PHP? And also if the user is using Anti-Virus or a Firewall on their system?

Any help is greatly appriciated. Thanks.
0
Comment
Question by:blaadom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 8

Accepted Solution

by:
Autogard earned 500 total points
ID: 17095298
>>To detect the browser name and the IP address at the moment. Is there a better method of detecting either of these?
>>Operating System:
>>What manufacturer
>>What version
>>What service pack

The best way I've seen is to use www.php.net/get_browser.  It gives you a pretty comprehensive list of attributes of your visitor.  It requires that you use the "browscap" file (mentioned in that link as well as a link to an updated one).

>>Would that code be able to detect IP addresses behind a proxy?

I don't know of a way of detecting an IP address behind a proxy because the proxy simply hides the IP of the originating user.

>>Some long shots! Is it possible to detect the Make and Model of the Router been used via PHP? And also if the user is using Anti-Virus or a Firewall on their system?

Don't know if it's possible
0
 
LVL 8

Expert Comment

by:Autogard
ID: 17095322
I should note that the "get_browser" and browscap just works from a text file that has browser specifications, so it will show you what OS, version, browser, version, etc... the user is running and it will tell you if those browsers support javascript, frames, etc... but it doesn't tell you (as far as I know) if the user actually has those capabilities enabled or not.

As for your last question -- I sure hope it's not possible to detect some of those things because it would make it real easy to spread viruses, etc...  But there are probably other ways of finding out that stuff.

Just curious, what is the use case that you have that requires you to know so much about a user? :-)
0
 

Author Comment

by:blaadom
ID: 17095360
I'm developing a website which retrives browser settings and the likes.
Something similar to http://www.showmyip.com/gb/
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 8

Expert Comment

by:Autogard
ID: 17095421
Wow, that's pretty involved.  Cool idea, though.

Yeah, you can get IP and host name using the method you explained above (I would also recommend using gethostbyaddr -- www.php.net/gethostbyaddr).  For some of the more advanced things, the browscap that I showed you should work.  There are other things like showing the country, etc... that would take extra work to do.

This should get you started at least though.
0
 

Author Comment

by:blaadom
ID: 17095733
showing the country and the isp as well as the users broadband exchange invloves getting an account with MaxMind, or similar, something on here http://www.maxmind.com/app/products . They have API's and the like but of course it costs money as you are using their database for some data mining. I might look into doing that if the website becomes proifitable.

It would be a nice touch as you mentioned. Thanks for the advise.
0
 
LVL 8

Expert Comment

by:Autogard
ID: 17095883
Yeah, because of so many variables (e.g. proxies, etc...) it is a really hard thing to be exact on the country and other similar information.  If you were to eventually go with a company like the one you mentioned I would make sure that they can guarantee some kind of accuracy or at least you can find out how they handle proxies, etc...

There are other free alternatives that may or may not be as good, I remember there being some EE questions on this topic.
0
 

Author Comment

by:blaadom
ID: 17096270
yes http://www.hostip.info/index.html is one site which offers a database of known IP addresses for free. http://ip-to-country.webhosting.info/ offer the same service.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question