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



About the author

Being the CEO and Founder of ClecoTech International, Mr. Ashish Prajapati is dedicated towards his aim of mentoring young startups into a full-fledged businesses. He is helping startups from America, Europe, India, and various other countries through proper guidance and the use of latest technologies to develop their innovation and ideas into definite realities.

Comments

  1. I am impressed. I don't think I've met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here
    Custom Counter Display Boxes
    Custom Christmas Boxes
    Printed on Demand Boxes UKCustom Soap Boxes
    Cannabis Tinctures Packaging
    Custom Vape Packaging
    E-Cigarette Boxes
    Printed on Demand Boxes UK

  2. 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.

  3. Get Your Custom Macaron Boxes – Wholesale Macaron Packaging Boxes with Logo Made in Custom Shapes, sizes, and layouts. We offer quality and error-free packaging services with free shipping in all the USA. Personalize your macaron boxes using one of our beautification design idea that will multiply the product’s attraction towards your customers. Get your desired custom macaron boxes to give a handmade look and perfect packaging to your macarons. Hence, the beautifully customized Retail and Wholesale Boxes is a perfect pick for your product collection. But at Papa, there are other shapes and styles of Custom Boxes available.

Leave a Reply

Your email address will not be published. Required fields are marked *