[英]Php : How to get localities based on ip address
I want to get localities based on IP address in Php. 我想根据Php中的IP地址获取位置。 I'm using geoplugin for based on IP, I got cities by using this
我正在使用基于IP的geoplugin,我通过使用此工具获得了城市
$ip_address = $_SERVER['REMOTE_ADDR'];
/*Get user ip address details with geoplugin.net*/
$geopluginURL='http://www.geoplugin.net /php.gp?ip='.$ip_address;
$addrDetailsArr = unserialize(file_get_contents($geopluginURL));
/*Get City name by return array*/
$city = $addrDetailsArr['geoplugin_city'];
/*Get Country name by return array*/
$country = $addrDetailsArr['geoplugin_countryName'];
Then, how to get locations of the city in selected field using this 然后,如何使用此方法在所选字段中获取城市的位置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.