Browse | Submit A New Snippet | Create A Package

 

IP2Location Ruby Library

Type:
Sample Code (HOWTO)
Category:
Database Manipulation
License:
Other
Language:
Ruby
 
Description:
IP2Location Ruby Library enables the user to find the Country, Region, City, Latitude, Longitude, ZIP code, Time zone, ISP, Domain name, Connection type, Area code and Weather station code of the location that any IP address or hostname originates from. This API is meant to allow easy integration between your program written in Ruby and
the IP2Location Binary (.BIN) data file. It has been optimized for speed and memory utilization. Developers can use the API to query all IP2Location™ binary databases for applications written in C or supporting static/dynamic library. Get more geolocation information at http://www.ip2location.com .

Versions Of This Snippet::

Hexa How
Snippet ID Download Version Date Posted Author Delete
57732010-01-21 07:24Hexa How

Download a raw-text version of this code by clicking on "Download Version"

 


Latest Snippet Version: :3

require 'IP2Location'

IP2LocObj = IP2Location.new()
IP2LocObj.open("data/IP-COUNTRY-SAMPLE.BIN")
rec = IP2LocObj.get_all("19.5.10.1")
puts rec.country_short
puts rec.country_long
puts rec.city
puts rec.region
puts rec.isp
puts rec.latitude
puts rec.longitude
puts rec.domain
puts rec.zipcode
puts rec.timezone
puts rec.netspeed
puts rec.iddcode
puts rec.areacode
puts rec.weatherstationcode
puts rec.weatherstationname
		

Submit a new version

You can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others..