User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Ruby section within the Web Development category of DaniWeb, a massive community of 332,776 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,815 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Ruby advertiser: SELL YOUR PRODUCT TODAY !
Dec 3rd, 2006
Views: 1,370
IP2Location is a Ruby library that enables the user to find the country, region, city, coordinates, zip code, ISP and domain name that any IP address or hostname originates from. 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.
Last edited : May 12th, 2007.
ruby Syntax
  1. <%
  2.  
  3. require 'IP2Location'
  4.  
  5. IP2LocObj = IP2Location.new()
  6. IP2LocObj.open("data/IP-COUNTRY-SAMPLE.BIN")
  7. rec = IP2LocObj.get_all("19.5.10.1")
  8. puts rec.country_short
  9. puts rec.country_long
  10. puts rec.city
  11. puts rec.region
  12. puts rec.isp
  13. puts rec.latitude
  14. puts rec.longitude
  15. puts rec.domain
  16. puts rec.zipcode
  17. puts rec.timezone
  18. puts rec.netspeed
  19.  
  20. %>
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 9:36 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC