可以查询ip的详细地址,使用百度接口
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| key | string | 是 | 接口调用密钥 | |
| ip | string | 是 | 需要查询的IPv4地址,默认使用客户端IP | 113.78.6.157 |
| type | string | 否 | 输出类型,text/text1/json | json |
[
{
"name": "key",
"type": "string",
"required": true,
"description": "接口调用密钥",
"example": ""
},
{
"name": "ip",
"type": "string",
"required": true,
"description": "需要查询的IPv4地址,默认使用客户端IP",
"example": "113.78.6.157"
},
{
"name": "type",
"type": "string",
"required": false,
"description": "输出类型,text/text1/json",
"example": "json"
}
]
{
"openapi": "3.1.1",
"info": {
"title": "IP地址查询2.0",
"description": "可以查询ip的详细地址,使用百度接口",
"version": "1.0.0"
},
"paths": {
"/api/zzgj/ipcx2.0/api.php": {
"get": {
"summary": "IP地址查询2.0",
"description": "可以查询ip的详细地址,使用百度接口",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "ip",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "113.78.6.157"
},
"description": "需要查询的IPv4地址,默认使用客户端IP"
},
{
"name": "type",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "json"
},
"description": "输出类型,text/text1/json"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"post": {
"summary": "IP地址查询2.0",
"description": "可以查询ip的详细地址,使用百度接口",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "ip",
"in": "query",
"required": true,
"schema": {
"type": "string",
"example": "113.78.6.157"
},
"description": "需要查询的IPv4地址,默认使用客户端IP"
},
{
"name": "type",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "json"
},
"description": "输出类型,text/text1/json"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://api-v2.317ak.com",
"description": "当前访问入口(https)"
}
]
}
{
"feature": "ip",
"target": "113.78.6.157",
"found": true,
"location": {
"country": "中国",
"province": "广东",
"city": "东莞",
"isp": "中国电信",
"display": "广东/东莞/中国电信",
"longitude": 113.76023,
"latitude": 23.048883,
"has_coordinates": true
},
"checked_at": 1790960133,
"request_id": "1f9552d6e21ce64457ef7907c5bff874"
}
提供 IP 地址详细信息查询服务,用于站长工具场景下获取 IP 所属地区等信息。
适用于网站管理、网络分析等需要查询 IP 地址信息的应用。
https://api.317ak.com/api/zzgj/ipcx2.0/api.php
GET、POST
本接口调用需要提供密钥。
首选鉴权方式:Query 参数。
请求时需在调用地址后添加 key 参数,例如 key=接口调用密钥。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| key | string | 是 | 接口调用密钥 |
| ip | string | 是 | 需要查询的 IPv4 地址,默认使用客户端 IP。示例:113.78.6.157 |
| type | string | 否 | 输出类型,可选值:text、text1、json。示例:json |
{
"feature": "ip",
"target": "113.78.6.157",
"found": true,
"location": {
"country": "中国",
"province": "广东",
"city": "东莞",
"isp": "中国电信",
"display": "广东/东莞/中国电信",
"longitude": 113.76023,
"latitude": 23.048883,
"has_coordinates": true
},
"checked_at": 1790960133,
"request_id": "1f9552d6e21ce64457ef7907c5bff874"
}
| 字段 | 类型 | 说明 |
|---|---|---|
| feature | string | 查询功能标识,固定为 ip |
| target | string | 查询的 IPv4 地址 |
| found | boolean | 是否查询到对应地址信息 |
| location | object | IP 地址归属信息 |
| location.country | string | 国家或地区名称 |
| location.province | string | 省份名称 |
| location.city | string | 城市名称 |
| location.isp | string | 网络服务提供商信息 |
| location.display | string | 格式化显示的地址信息 |
| location.longitude | number | 经度坐标 |
| location.latitude | number | 纬度坐标 |
| location.has_coordinates | boolean | 是否包含坐标信息 |
| checked_at | integer | 查询时间标识 |
| request_id | string | 本次请求标识 |
{
"code":0,
"msg":"密钥错误",
"errcode":11002
}
| errcode | 含义 |
|---|---|
| 11001 | 未提供调用密钥 |
| 11002 | 密钥错误 |
| 11003 | 密钥已禁用 |
| 11004 | 积分余额不足 |
| 11005 | 请求过于频繁(QPM 限制) |
| 11006 | 接口维护中 |
| 11007 | 接口已禁用 |
| 11008 | 接口不可用 |
| 11009 | 密钥校验暂不可用 |
| 11010 | 积分系统暂不可用 |
| 11011 | 收费接口须提供有效密钥 |
| 11012 | 鉴权方式错误 |
| 11013 | 接口不存在 |
| 11014 | ***地址无效 |
| 11015 | ***地址不允许 |
| 11016 | ***请求失败 |
| 11017 | 服务暂不可用 |
| 11018 | 请求方式不允许 |
| 11019 | 当前IP不在白名单内 |
| 11020 | 启用出口代理须提供有效密钥 |
| 11021 | 未配置可用出口代理 |
| 11022 | 出口代理不可用 |
| 11023 | 密钥已过期 |
| 11024 | 令牌分配积分不足 |
curl -G "https://api.317ak.com/api/zzgj/ipcx2.0/api.php" \
--data-urlencode "key=你的接口密钥" \
--data-urlencode "ip=113.78.6.157" \
--data-urlencode "type=json"
// PHP
key 传递,例如:key=你的接口调用密钥。请妥善保管密钥,避免公开分享或泄露。ip 参数用于指定需要查询的 IPv4 地址;如未指定查询目标,将默认使用客户端 IP 进行查询。传入的 IP 地址应为合法 IPv4 格式,例如 113.78.6.157。type 参数用于选择返回格式,可填写 text、text1 或 json。如需结构化数据处理,建议使用 json 格式。curl "https://api.317ak.com/api/zzgj/ipcx2.0/api.php?key=YOUR_API_KEY&ip=113.78.6.157&type=json" \
-X GET