用于检查自己的IP
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| key | string | 是 | 接口调用密钥 | |
| type | string | 否 | json或者text,不填则默认json | json |
[
{
"name": "key",
"type": "string",
"required": true,
"description": "接口调用密钥",
"example": ""
},
{
"name": "type",
"type": "string",
"required": false,
"description": "json或者text,不填则默认json",
"example": "json"
}
]
{
"openapi": "3.1.1",
"info": {
"title": "IP检测",
"description": "用于检查自己的IP",
"version": "1.0.0"
},
"paths": {
"/api/zzgj/ipjc/api.php": {
"get": {
"summary": "IP检测",
"description": "用于检查自己的IP",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "type",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "json"
},
"description": "json或者text,不填则默认json"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"post": {
"summary": "IP检测",
"description": "用于检查自己的IP",
"parameters": [
{
"name": "key",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "接口调用密钥"
},
{
"name": "type",
"in": "query",
"required": false,
"schema": {
"type": "string",
"example": "json"
},
"description": "json或者text,不填则默认json"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://api.317ak.com",
"description": "当前访问入口(https)"
}
]
}
{
"ip": "59.39.220.172"
}
用于检查当前访问IP信息,帮助用户快速获取自己的IP地址。
适用于站长工具场景下的IP查询与检测需求。
https://api-v2.317ak.com/api/zzgj/ipjc/api.php
支持 GET、POST 请求。
接口调用必须提供密钥,首选通过 Query 参数传递:
key=…
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| key | string | 是 | 接口调用密钥,通过 Query 参数传递,格式为 key=…。 |
| type | string | 否 | 返回格式类型,可填写 json 或 text,不填写时默认返回 json。 |
请求成功后返回当前检测到的 IP 信息,默认返回 JSON 格式。
{
"ip": "59.39.220.172"
}
| 字段 | 类型 | 说明 | |
|---|---|---|---|
| ip | string | 当前检测到的 IP 地址 |
接口发生业务错误时,将返回 JSON 格式错误信息:
{"code":0,"msg":"未提供调用密钥","errcode":11001}
| 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 "https://api-v2.317ak.com/api/zzgj/ipjc/api.php?key=YOUR_KEY&type=json"
// PHP
key,避免将密钥直接暴露在前端页面、客户端代码或公开环境中。key 参数填写正确,否则可能导致请求失败。type 参数可选,支持填写 json 或 text。不填写时默认返回 JSON 格式数据,请根据实际使用场景选择返回类型。ip 字段为检测到的 IP 信息,请根据接口返回内容进行处理,不建议仅依赖固定格式进行扩展解析。curl "https://api-v2.317ak.com/api/zzgj/ipjc/api.php?key=YOUR_API_KEY&type=json"