views:

259

answers:

3

I'd like to use visitor IP addresses into a company name. This will be used for displaying something like "Hello visitor from Apple Inc." . Note I am looking for the company name, not the domain name. Extra points for determining the originating country. The app is written in Ruby on Rails, but examples in other languages will do. Thanks!

+4  A: 

There are databases for this kind of thing, but they are hardly 100% accurate, so I'd think long and hard before using them to make assumptions regarding content you present to your visitors. If you still want to do it, here are two companies that offer databases that include organization level detail:

http://www.maxmind.com/app/ip-location
http://www.ip2location.com/

Edit to clarify based on additional answers:

The organization level detail in the databases from these vendors is different than ISP information, which is what the others are referring to. The databases from the vendors above are actually assigned organizational information based on research, not reverse lookup on IP ownership.

Chris
thanks- just what I needed!
A: 

You're very likely to get this more wrong than right, but you can get this from a whois client.

For example, to see owners of US addresses (at least), you can whois from the CLI to play around:

whois -h whois.arin.net 17.18.19.20
Dustin
+4  A: 

For starters, know that often it is impossible - e.g. many people's connection will be from Insight, or Comcast, or whatever their ISP is. I'm not sure if your intended feature is all that snazzy if you greet me as being "from" Insight Broadband.

pc1oad1etter