There are few approaches to find the location of the visitor with their IP. I’ll show you some of the approaches that I know :
Just Include a file
wherever you want to display. See below how it displays the result :
Powered by IP Address Locator
Original Source by
Another method is by using service like :
Call this URL with REST Method and get the result :
I, personally don’t recommend to use it, because it has very poor output. May be below 60% accuracy.
See the result below, how accurately this method is showing your location:
- For Database approach see the link http://www.maxmind.com/app/geoip_country. You can get Many sites which will provide the database with codes package.