🌺 IP信息查询
概述
本 API 提供了基于 IP 地址的地理位置信息查询功能。通过调用此 API,您可以获取与 IP 地址相关的以下信息:
IP 地址、城市(City)、区域Region)、国家(Country)、邮政编码(Postal)、定位信息(Loc)、组织(Org)、时区(Timezone)、
基本信息
- 接口地址:
https://api.xk.ee/ip/?ip= - 备用地址:
https://api.ku.cm/ip/?ip= - 请求方式: GET
- 返回格式: JSON
请求参数
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
| ip | string | 是 | 需要查询的 IP 地址。若不提供,将查询访问者的 IP 地址。 |
响应说明
API 返回的数据为 JSON 格式,包含与查询 IP 地址相关的详细信息。以下是响应的字段说明:
| 字段 | 类型 | 描述 |
|---|---|---|
| ip | string | IP 地址 |
| city | string | 城市名称 |
| region | string | 区域名称 |
| country | string | 国家代码(两位) |
| postal | string | 邮政编码 |
| loc | string | 定位信息(经纬度,格式为“latitude,longitude”) |
| org | string | 组织名称或网络服务商信息 |
| timezone | string | 时区名称 |
响应示例
请求:https://api.xk.ee/ip/?ip=183.210.93.140
成功响应的 JSON 数据示例如下:
{
"code": 200,
"msg": "success",
"result": {
"ip": "183.210.93.140",
"continent": "亚洲",
"country": "中国",
"province": "江苏省",
"city": "扬州市",
"district": "邗江区",
"isp": "中国移动",
"areacode": "321003",
"countrycode": "CN",
"countryenglish": "China",
"timezone": "UTC+8",
"latitude": "32.37773",
"longitude": "119.39810"
}
}
错误代码
- 401 Unauthorized:API 密钥无效或上游网络异常。
- 403 Forbidden:请求被拒绝,可能是由于访问限制(如 IP 白名单设置)。
- 404 Not Found:请求的 IP 地址无效或没有找到。
- 500 Internal Server Error:服务器错误,通常是由于服务器端问题。
常见问题
检查 ip :是否正常传递数据查询。
检查访问限制:某些地区或IP段被屏蔽(例如,仅允许特定 IP 或域名访问)。
因使用第三方ip库封装,限制请求10000次/日