因为百度ip转换增加了密匙验证,所以导致之前的接口无法再转换ip地址的信息,通过更换淘宝的API进行修复。具体方法如下:
打开includecloud.func.php文件
找到function iplookup($ip) {
修改iplookup函数为
function iplookup($ip) {
$url = 'http://ip.taobao.com/service/getIpInfo.php?ip='.$ip;
//$url = 'http://apistore.baidu.com/microservice/iplookup?ip='.$ip;
$rec = dcurl($url);
$area = '';
if(strpos($rec, 'data') !== false) {
//if(strpos($rec, 'retData') !== false) {
$tmp = json_decode($rec, true);
$arr = $tmp['data'];
//$arr = $tmp['retData'];
if(base64_encode($arr['country']) != '5Lit5Zu9') {
if(isset($arr['country'])) $area .= $arr['country'];
if(isset($arr['area'])) $area .= $arr['area'];
}
if(isset($arr['region'])) $area .= $arr['region'];
//if(isset($arr['province'])) $area .= $arr['province'];
if(isset($arr['city']) && $arr['city'] != $arr['province']) $area .= $arr['city'];
if(isset($arr['district'])) $area .= $arr['district'];
if(isset($arr['carrier'])) $area .= ' '.$arr['carrier'];
}
return $area ? convert($area, 'UTF-8', DT_CHARSET) : 'Unknown';
}
再登录后台,即可看到问题已解决。