接口演示
接口代码
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
$ua = $_SERVER['HTTP_USER_AGENT'];
$url="http://ip.taobao.com/service/getIpInfo.php?ip=".$ip;
$urldata=file_get_contents($url);
$data = json_decode($urldata, true);
$country = $data['data']['country'];
$region = $data['data']['region'];
$city = $data['data']['city'];
$arr = array('IP' => $ip,'Region' =>$country.''.$region.''.$city , 'OS' => $os, 'UA' => $ua,'Bro' => $bro, 'Time' => date("Y年m月d日 H时i分s秒"));
echo json_encode($arr,JSON_UNESCAPED_UNICODE);
?>
文章附件蓝奏网盘