<?php
header('Content-type: text/html; charset=utf-8');
//根据ip获取城市、网络运营商等信息
function findCityByIp($ip){
$data = file_get_contents('http://ip.taobao.com/service/getIpInfo.php?ip='.$ip);
$result = json_decode($data,$assoc=true);
$city=$result['data']['region'];
$len = (strlen($city)-3)/3;
$cityname = mb_substr($city,0,$len,'utf-8');
return $cityname;
}


$ip = '27.184.128.234';
echo $aa = findCityByIp($ip);


?>

ip 淘宝ip库 精简版

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2022-02-16
  • 2021-10-25
  • 2022-01-10
猜你喜欢
  • 2021-12-25
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
相关资源
相似解决方案