【问题标题】:Get Address detail of user by his IP? [duplicate]通过他的 IP 获取用户的地址详细信息? [复制]
【发布时间】:2015-12-26 11:48:12
【问题描述】:

我找到了很多结果,但我没有得到任何 Ip 的解决方案。 我想用php查找全世界的用户ip详细信息,但找不到。

【问题讨论】:

标签: php


【解决方案1】:

你可以用这个:

$ip是用户的IP地址。

$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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-08
    • 1970-01-01
    • 2014-11-08
    • 2018-02-05
    • 1970-01-01
    • 1970-01-01
    • 2015-02-27
    相关资源
    最近更新 更多