根据ip获取地址

php 根据ip获取地址

js方法获取用户的 ip 和 地址

获取用户的来源:$_SERVER[‘HTTP_REFERER’]

获取用户的 IP:$ip = $_SERVER[“REMOTE_ADDR”];

获取用户的地址:

1 > 使用淘宝API接口

function getCity(KaTeX parse error: Expected '}', got 'EOF' at end of input: ip = '') { if(ip == ‘’){
$url = “http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json”;
i p = j s o n d e c o d e ( f i l e g e t c o n t e n t s ( ip=json_decode(file_get_contents( ip=jsondecode(filegetcontents(url),true);
$data = $ip;
}else{
u r l = " h t t p : / / i p . t a o b a o . c o m / s e r v i c e / g e t I p I n f o . p h p ? i p = " . url="http://ip.taobao.com/service/getIpInfo.php?ip=". url="http://ip.taobao.com/service/getIpInfo.php?ip=".ip;
i p = j s o n d e c o d e ( f i l e g e t c o n t e n t s ( ip=json_decode(file_get_contents( ip=jsondecode(filegetcontents(url));
if((string)$ip->code==‘1’){
return false;
}
d a t a = ( a r r a y ) data = (array) data=(array)ip->data;
}

return $data;
}

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值