【PHP】获取ip信息,并做限制
【摘要】
author:咔咔
wechat:fangkangfk
$ip = '113.139.214.239'; $content = file_get_contents('http://ip.taobao.com/service/getIpInfo.php?ip='.$ip); $banned = json_d...
author:咔咔
wechat:fangkangfk
-
$ip = '113.139.214.239';
-
$content = file_get_contents('http://ip.taobao.com/service/getIpInfo.php?ip='.$ip);
-
$banned = json_decode(trim($content), true);
-
dump($banned);die;
接口用的是淘宝的,下面是返回值
-
C:\phpStudy\PHPTutorial\WWW\tp5\thinkphp\library\think\Debug.php:226:
-
array (size=2)
-
'code' => int 0
-
'data' =>
-
array (size=13)
-
'ip' => string '56.23.52.41' (length=11)
-
'country' => string '美国' (length=6)
-
'area' => string '' (length=0)
-
'region' => string '北卡罗来纳' (length=15)
-
'city' => string 'XX' (length=2)
-
'county' => string 'XX' (length=2)
-
'isp' => string 'XX' (length=2)
-
'country_id' => string 'US' (length=2)
-
'area_id' => string '' (length=0)
-
'region_id' => string 'US_133' (length=6)
-
'city_id' => string 'xx' (length=2)
-
'county_id' => string 'xx' (length=2)
-
'isp_id' => string 'xx' (length=2)
文章来源: blog.csdn.net,作者:咔咔-,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/fangkang7/article/details/89840442
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)