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

8th Apr 2018, 6:33 PM
Arshad Ansari
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"];
8th Apr 2018, 7:26 PM
Toni Isotalo
Toni Isotalo - avatar
0
No it can be done by js and php too i tried and it's working but it doesn't support chrome
8th Apr 2018, 7:17 PM
Arshad Ansari
0
Thank you toni for your feedback i will try this..
8th Apr 2018, 7:27 PM
Arshad Ansari