cjheath / geoip

The Ruby gem for querying Maxmind.com's GeoIP database, which returns the geographic location of a server given its IP address
http://geoip.rubyforge.org/
GNU Lesser General Public License v2.1
714 stars 90 forks source link

cities from the country/state #15

Open cooolbasha opened 12 years ago

cooolbasha commented 12 years ago

Hi, Is there a way to get the cities from the country/state combination.

Thanks

cjheath commented 12 years ago

On 12/11/2011, at 1:05 AM, cooolbasha wrote:

Is there a way to get the cities from the country/state combination.

Not that I know of - but you might check the C API provided by Maxmind. If they provide a way to do what you want, we can fairly easily add it to the Ruby version.

Clifford Heath.

joseluistorres commented 12 years ago

Hi there, is anyone having an issue like this?

If I run in my local MACOSX: gp = GeoIP.new('GEOIPCity.dat').city("Aguascalientes, Jalisco") It finds the correct record, but if I run the same in our stage env, which is an Ubuntu, it works only with DNS names and IP address, does anyone know why?

I've been reading the code but I have no idea why is finding it... I'm more than happy to fix it, if you can give me a clue

cjheath commented 12 years ago

The city method takes a DNS name or a string representation of an IP address - not a city name. If "Aguascalientes, Jalisco" is getting resolved, it's because your DNS service is doing it - it's nothing to do with GeoIP.