【发布时间】:2015-05-24 14:05:01
【问题描述】:
我想通过我的网站访问者的 IP 找到他们的位置(国家、城市、..)。 我正在编写php。 谁能帮我? 像这样:
$url = json_decode(file_get_contents("http://api.ipinfodb.com/v3/ip-city/?key=/*userapikey*/
ip=".$_SERVER['REMOTE_ADDR']."&format=json"));
$country=$url->countryName; // user country
$city=$url->cityName; // city
$region=$url->regionName; // regoin
$latitude=$url->latitude; //lat and lon
$longitude=$url->longitude;
【问题讨论】: