ip2location facebbook  ip2location twitter  ip2location google+ ip2location github

IP2Proxy Ruby Library

This Ruby library supports all IP2Proxy™ BIN database products to query proxy IP address and its country, region, city, ISP name and proxy types. It has been optimized for speed and memory utilization.

Download Download   Source Source

 

Installation
ZIP Installation
  1. Download and unzip and package from
  2. gem build ip2proxy_ruby.gemspec
  3. gem install ip2proxy_ruby
  4. Run the script
    ruby -rubygems example.rb
RubyGems Installation
  1. gem install ip2proxy_ruby
  2. Run the script
    ruby -rubygems example.rb

 

Sample Codes
require 'ip2proxy_ruby'

# open IP2Proxy BIN database for proxy lookup
i2p = Ip2proxy.new.open("./data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")

# get versioning information
print 'Module Version: ' + i2p.getModuleVersion + "\n"
print 'Package Version: ' + i2p.getPackageVersion + "\n"
print 'Database Version: ' + i2p.getDatabaseVersion + "\n"

# individual proxy data check
print 'Is Proxy: ' + i2p.isProxy('4.0.0.47').to_s + "\n"
print 'Proxy Type: ' + i2p.getProxyType('4.0.0.47') + "\n"
print 'Country Code: ' + i2p.getCountryShort('4.0.0.47') + "\n"
print 'Country Name: ' + i2p.getCountryLong('4.0.0.47') + "\n"
print 'Region Name: ' + i2p.getRegion('4.0.0.47') + "\n"
print 'City Name: ' + i2p.getCity('4.0.0.47') + "\n"
print 'ISP: ' + i2p.getISP('4.0.0.47') + "\n"

# single function to get all proxy data returned in array
record = i2p.getAll('4.0.0.47')
print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
print 'Proxy Type: ' + record['proxy_type'] + "\n"
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 'ISP: ' + record['isp'] + "\n"

# close IP2Proxy BIN database
i2p.close()

 

IP2Proxy LITE BIN Database

Developers may subscribe the free IP2Proxy LITE BIN database for testing and evaluation purpose. Please take note that the LITE database is limited to public proxies (PUB) IP address. Commercial databases consist of other proxy types such as Tor, VPN and etcs.