数据库正常 IPv4 + IPv6 库版本 2026-10-28 23:08:12

纯真 IP 库查询接口

基于纯真网络(CZ88)离线库,支持 IPv4 与 IPv6,毫秒级返回国家、省份、城市、区县与运营商。
一个 PHP 文件即插即用,无需数据库、无需安装。

接口地址 https://ip.zgyw.top/ip.php · 支持逗号分隔批量查询(最多 50 个)

接口说明

请求参数

参数必填说明
ip否要查询的 IP,IPv4 / IPv6 均可。多个用英文逗号分隔。不传则查询请求方自己的 IP
format否json(默认)/ text 纯文本 / jsonp 跨域回调
callback否配合 format=jsonp 使用,回调函数名
type否1 打开本页面,3 返回库信息(版本、条数、字段)
key否接口密钥,仅在源码里设置了 API_KEY 后校验

返回字段

字段说明
ip查询的 IP
ip_version4 或 6
country国家名称
province省份(国外为州/区域)
city城市
district区县
isp运营商 / 机构名称
country_codeISO 国家代码,如 CN、US
continent大洲代码,如 AS、NA
area省+市 拼接,如「江苏南京」
location完整地理位置,如「中国 江苏 南京」
text一行完整文本:国家 省 市 区县 运营商
is_china是否中国大陆,布尔值

返回示例

{
  "code": 200,
  "msg": "success",
  "data": {
    "ip": "114.114.114.114",
    "ip_version": 4,
    "country": "中国",
    "province": "江苏",
    "city": "南京",
    "district": "",
    "isp": "南京信风网络科技有限公司GreatbitDNS服务器",
    "country_code": "CN",
    "continent": "AS",
    "area": "江苏南京",
    "location": "中国 江苏 南京",
    "is_china": true,
    "text": "中国 江苏 南京 南京信风网络科技有限公司GreatbitDNS服务器",
    "owner_domain": ""
  },
  "ms": 0.71
}

调用示例

# 命令行
curl "https://ip.zgyw.top/ip.php?ip=114.114.114.114"

# 纯文本(适合直接显示)
curl "https://ip.zgyw.top/ip.php?ip=114.114.114.114&format=text"

# IPv6
curl "https://ip.zgyw.top/ip.php?ip=2400:3200::1"

# 批量
curl "https://ip.zgyw.top/ip.php?ip=8.8.8.8,1.1.1.1,223.5.5.5"
// 浏览器 / 小程序
fetch('https://ip.zgyw.top/ip.php?ip=114.114.114.114')
  .then(r => r.json())
  .then(res => console.log(res.data.location, res.data.isp));
// PHP
$r = json_decode(file_get_contents('https://ip.zgyw.top/ip.php?ip=114.114.114.114'), true);
echo $r['data']['location'];
# Python
import requests
r = requests.get('https://ip.zgyw.top/ip.php', params={'ip': '114.114.114.114'}).json()
print(r['data']['text'])

状态码

code说明
200成功
400参数错误,IP 格式不正确或为空
403API Key 无效(仅当开启了密钥校验)
404库中没有该 IP 的记录
429超出频率限制
500数据库文件缺失或损坏

使用须知