Skip to navigation
How to detect the country of a ip with ruby?
07.12.13
in rails and merb use the folling after downloading and installing the ip2c db: require 'ipaddr' ip_address = request.remote_ip() ip = IPAddr.new(ip_address) country = Iptoc.find(:first, :conditions => ["id<= ? AND ip_to >= ?", ip.to_i, ip.to_i])
Reply
Anonymous
how to detect the country of a ip with ruby?
in rails and merb use the folling after downloading and installing the ip2c db: require 'ipaddr' ip_address = request.remote_ip() ip = IPAddr.new(ip_address) country = Iptoc.find(:first, :conditions => ["id<= ? AND ip_to >= ?", ip.to_i, ip.to_i])
07.12.13
Reply
Anonymous
Information Epoch 1732386109
Worse is better.
Home
Notebook
Contact us