top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to get the location detail of a IP Address in Java or PHP?

+3 votes
644 views

Any opensource code would be a great help :)

posted May 2, 2015 by Salil Agrawal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

We can use Geoplugin API.

Geoplugin is a webservice which allows you to find Location based upon the IP of the client. It shows City, region, country, latitude , longitude etc of the IP address.

We can integrate running website, using following code:

<php
echo var_export(unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR'])));
?>
answer May 2, 2015 by Amit Kumar Pandey
Thanks let me give a try
Similar Questions
+1 vote

I want a JAVA program. That gets the website name from the user and prints the IP Address of that website.

+1 vote
0 votes

Is there a way to extract out of some environmental variable the Geo location of the user being the city the user visits out website from? Perhaps by utilizing his originated ip address?

...