geocoding - ruby: given an ip address, find out the City and State -
i've been searching ten minutes, haven't found simple code sample yet.
basically, i'm looking this:
puts geocoder.lookup_location_by_ip("76.95.251.102") result california, usa so ruby method decodes ip address in city, state.
these steps:
install geocoder using:
gem install geocoderin ruby script use:
require "geocoder" puts geocoder.address('76.95.251.102') #change ip address accordingly.run script city, state, zipcode, country.
# => bellflower, ca 90706, united states
Comments
Post a Comment