接上文,增加一个IP查询功能
调用新浪接口查IP,
> function city_ip($ip) {
> $url = ‘http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=‘ . $ip;
> $f = new SaeFetchurl();
> $str = $f->fetch($url);
> preg_match(‘|var remote_ip_info =(.*)\;|’,$str,$ar);
> $obj = json_decode($ar[1]);
> $city =$obj->city;
> return $city;
> }
more >>