原生态php在线获取IP定位
2017-02-21 16:51
274 查看
原生态php在线获取IP定位
<?php /** * 获取 IP 地理位置 * 在线获取地理位置 * 淘宝IP接口 * @Return: array */ function getCity($ip = '') { if($ip == ''){ $url = "http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json"; $ip=json_decode(file_get_contents($url),true); $data = $ip; }else{ $url="http://ip.taobao.com/service/getIpInfo.php?ip=".$ip; $ip=json_decode(file_get_contents($url)); if((string)$ip->code=='1'){ return false; } $data = (array)$ip->data; } return $data; } ?>
相关文章推荐
- 封装的 php 函数实例 获取客户端IP 获取在线IP 获取url 获取当前站点的访问路径根目录 数字转人民币
- php 获取在线IP+
- PHP 获取在线IP
- php 获取用户真实ip
- PHP获取访问用户IP
- php获取IP代码
- php中$_SERVER参数HTTP_X_FORWARDED_FOR & REMOTE_ADDR与获取IP
- PHP获取真实的客户IP
- 同一域名对应多个IP时,PHP获取远程网页内容的函数
- 深入分析几种PHP获取客户端IP的情况
- PHP调用外部服务获取IP地域信息实现信息的地域性关联
- php之获取访客IP
- PHP获取客户端IP的方法
- PHP获取IP的多种方式解析
- 同一域名对应多个IP时,PHP获取远程网页内容的函数[原创]
- PHP获取客户端IP
- php REMOTE_ADDR之获取访客IP的代码
- 转:获取电信,网通,铁通APNIC权威IP数据集[PHP源程序]
- php统计IP以及在线人数的统计
- PHP获取IP的多种方式解析