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

16 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. 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
  3. 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

  4. 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
  5. I’ve recently started a blog, the info you provide on this web site has helped me tremendously. Thanks for all of your time & work.
    Printed Labels
    Printed Stickers UK
    Inset Printing

    ReplyDelete
  6. I must say, i believed this was a pretty fascinating browse when it involves this subject. Liked the material la web design

    ReplyDelete
  7. I’ve been absent for a while, but now I remember why I used to love this website. Thanks , I’ll try and check back more often. How frequently you update your web site? web design agencies los angeles

    ReplyDelete
  8. Obviously I like your web site, but you have to take a look at the spelling on quite a few of your posts. Several of them are rife with spelling problems and I find it very bothersome to inform you. Nevertheless I will surely come again again! website design company

    ReplyDelete
  9. Routers are the most important devices that are required to get the internet connectivity. There are many brands and router models around the globe. Most people use multiple brand routers, they don't know how to configure them for the perfect usage. Here at https://router-networks.com we have all the manuals for configuring the router login pages.


    ReplyDelete
  10. I like the valuable info you provide in your articles. I will bookmark your blog and check again here frequently. I am quite certain I will learn many new stuffs right here! Good luck for the next!
    factory outlets market of clothing brands in Lahore

    ReplyDelete
  11. A very excellent blog post. I am thankful for your blog post. I have found a lot of approaches after visiting your post. Soap boxes

    ReplyDelete