Hello, I want to know how to determine a location from IP address in Rails. For example, 126.96.36.199 is from which country, using which ISP, Time Zone, lat and lng. Appreciate if have any ideas? Thanks Chamnap
on 2007-06-08 10:57
on 2007-06-12 02:40
Chamnap wrote: > Hello, > > I want to know how to determine a location from IP address in Rails. > For example, 188.8.131.52 is from which country, using which ISP, Time > Zone, lat and lng. > Appreciate if have any ideas? > > Thanks > Chamnap If you are looking for a free one you can use this: www . hostip . info (the spam catchers weren't letting this through the normal way so I added the whitespace). There are better ones out there that are commercial. The data is a little bit better so with the commercial ones if I remember so, you'll have to weigh the difference between cost and accuracy. To get Ruby on Rails to work with the site I mentioned, you will have to send your request in this format: http://api. hostip . info/?ip=184.108.40.206 (remove the whitespace) and it will return your data in XML: <gml:name>Sugar Grove, IL</gml:name> <countryName>UNITED STATES</countryName> <countryAbbrev>US</countryAbbrev> so you'll have to parse the returned XML via Ruby on Rails to get what you need. I hope this gets you in the right direction. Unfortunately, in terms of exactly how to code it in Ruby on Rails, I am not sure.
on 2007-06-12 02:52
Thanks steve and mike.