0
How to get current location of user only city and country name using php
How to get current location of user only city and country name using php in a textbox
3 Answers
+ 6
I made some research and I found that you can use this API
http://www.geoplugin.net/php.gp?ip=
Try to get client IP with this
$ip = $_SERVER['REMOTE_ADDR'];
And make a request to that url.
$json = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$ip"));
echo $json["geoplugin_countryName"];
0
No it can be done by js and php too i tried and it's working but it doesn't support chrome
0
Thank you toni for your feedback i will try this..