Find Latitude Longitude using Ip address


Below mentioned way is to get lat long using ip address

It allows 250 requests in a minute

http://ip-api.com

Using Net::HTTP

require 'net/http'

class LatLong
def self.find(remote_ip)
Proc.new{
   url = URI.parse("http://ip-api.com/json/#{remote_ip}")
req = Net::HTTP::Get.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) {|http|
   http.request(req)
}
JSON.parse res.body
}
end
end


Using open-uri

// Open URI way

require 'open-uri'

# Class for writing all the custom geocoding related code
class LatLong
# method for finding the ip address related details
def self.find(remote_ip)
Proc.new{
res = open(url).read
JSON.parse res
}
end
end



Post a Comment

13 comments:

  1. Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also
    Transparent stickers

    ReplyDelete
  2. I am certainly making the most of your site. You unquestionably have some extraordinary knowledge and incredible stories.
    embossed stickers

    ReplyDelete
  3. I always appreciate quality content, Thanks to you for sharing such post.
    Ask Questions Get Answers

    ReplyDelete
  4. Hi! Great work. I feel nice to be here reading your authentic work.
    Custom Sticker

    ReplyDelete


  5. 192.168.0.1

    192.168.1.1

    router login
    Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now,

    ReplyDelete
  6. Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for. I would like to recommend you that please keep sharing such type of info.If possible, Thanks. https://192-168-i-i.com

    ReplyDelete
  7. Fine information, many thanks to the author. It is puzzling to me now, but in general, the usefulness and importance is overwhelming. Very much thanks again and best of luck!
    Custom Boxes
    new birthday wishes

    ReplyDelete

  8. 192.168.1.254

    192.168.l.254

    192.168.1.1

    192.168.o.1

    192.168.l0.1

    192.168.l.l

    192.168.o.1

    is a Private IP address and most powerful universal IP addresses, this is used in the Linksys router.

    ReplyDelete