Sha256: e53794370842293da499bedd387aeda288f054a48f50711d4288ac9b66679c99
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
require 'ip2location_ruby' # BIN Database i2l = Ip2location.new.open("./data/IP2LOCATION-LITE-DB1.IPV6.BIN") record = i2l.get_all('8.8.8.8') print 'Country Code: ' + record['country_short'] + "\n" print 'Country Name: ' + record['country_long'] + "\n" print 'Region Name: ' + record['region'] + "\n" print 'City Name: ' + record['city'] + "\n" print 'Latitude: ' print record['latitude'] print "\n" print 'Longitude: ' print record['longitude'] print "\n" print 'ISP: ' + record['isp'] + "\n" print 'Domain: ' + record['domain'] + "\n" print 'Net Speed: ' + record['netspeed'] + "\n" print 'Area Code: ' + record['areacode'] + "\n" print 'IDD Code: ' + record['iddcode'] + "\n" print 'Time Zone: ' + record['timezone'] + "\n" print 'ZIP Code: ' + record['zipcode'] + "\n" print 'Weather Station Code: ' + record['weatherstationname'] + "\n" print 'Weather Station Name: ' + record['weatherstationcode'] + "\n" print 'MCC: ' + record['mcc'] + "\n" print 'MNC: ' + record['mnc'] + "\n" print 'Mobile Name: ' + record['mobilebrand'] + "\n" print 'Elevation: ' print record['elevation'] print "\n" print 'Usage Type: ' + record['usagetype'] + "\n" i2l.close() # Web Service ws = Ip2locationWebService.new('demo', 'WS24', true) record = ws.lookup('8.8.8.8', 'continent,country,region,city,geotargeting,country_groupings,time_zone_info', 'en') print record print "\n" print ws.get_credit()
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ip2location_ruby-8.2.3 | example.rb |
ip2location_ruby-8.2.2 | example.rb |
ip2location_ruby-8.2.1 | example.rb |