HeQee

Feed Rss

IP归属地查询接口PHP版

11.09.2009, Apps, by .

使用之前请去网上下载纯真IP数据库, “QQWry.dat” 放到当前目录下即可

<?php
/*
IpLocation API
使用之前请去网上下载纯真IP数据库, "QQWry.dat" 放到当前目录下即可
*/
include "libs/iplocation.class.php";
#需要查询的IP
$ip = "221.231.1.1";
//返回格式
$format = "text";//默认text,json,xml,js
//返回编码
$charset = "utf8"; //默认utf-8,gbk或gb2312
#实例化(必须)
$ip_l=new ipLocation();
$address=$ip_l->getaddress($ip);

$address["area1"] = iconv('GB2312','utf-8',$address["area1"]);
$address["area2"] = iconv('GB2312','utf-8',$address["area2"]);

$add=$address["area1"]." ".$address["area2"];

echo $add;
?>

演示:http://www.heqee.com/apps/ip/
下载开源代码地址:http://www.heqee.com/apps/download/IpLocationApi.rar

声明: 本站遵循 署名-非商业性使用-相同方式共享 3.0 共享协议.转载请注明转自 HeQee

IP归属地查询接口PHP版 有 6 条回应

  1. 对这个感兴趣的人不多啊……呵呵

  2. “位于 api.heqee.com 的服务器响应时间过长。”

    囧rz,api 怎么不能访问了?我们的项目正在用它呢

    lz 赶紧恢复吧

    坐等呐!!!!!!

  3. 服务器出现故障,正在排除中。推荐你下载源码放在自己的服务器上。那样响应快。而已IP数据库可以定期更新。不受外界影响

  4. 博主,下载源码本地测试了一下,
    但查询域名后,不能像
    http://www.heqee.com/apps/ip/
    那样,除了显示地理位置,还显示IP。。。
    只能显示地理位置??

  5. 2010-10-09 在 11:04 coffeetion

    http://api.heqee.com/ip/?ip=222.172.200.68

    这样的地址返回的值,如何用js或者php调用呢?

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


无觅相关文章插件,快速提升流量