duanqiang5722
duanqiang5722
2015-09-29 05:45

通过他的IP获取用户的地址详细信息? [重复]

已采纳

This question already has an answer here:

I found many results, but i didn't get any solution for Ip's. I want to find the user ip details all over the world by using php, but not able to find it.

</div>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dopr25398 dopr25398 6年前

    You can use this:

    $ip is user's ip address.

    $ip = $_SERVER['REMOTE_ADDR'];
        $data = file_get_contents("http://www.geoplugin.net/json.gp?ip=". $ip);
        $data = json_decode($data);
    
    echo $data->geoplugin_countryName; // and so on
    
    点赞 评论 复制链接分享