Drop Shadow
Drop Shadow

Reputation: 808

Locate user location on google map using IP address

I want to locate user location on google map. i don't have user lat and long. Is it possible to find out the location through IP address with PHP ???

Upvotes: 2

Views: 2705

Answers (2)

abielita
abielita

Reputation: 13469

From the Google documentation, they don't recommend using Geolocation because a user's IP address can only provide a rough estimate of a user's location.

The W3C approach is the easiest and most fully-supported so it should be prioritized over other methods.

I also found this example which might help.

Upvotes: 0

Jatin Luthra
Jatin Luthra

Reputation: 176

You can use Geoplugin for php which helps to pin point client's location. Following syntax may work.

<php
echo var_export(unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR'])));
?>

Upvotes: 2

Related Questions