cURL
curl "https://api.ruseo.cn/api/ip_query?key=YOUR_API_KEY&ip=8.8.8.8"
查询IP地理位置及归属地信息,不传IP时默认使用当前访问IP。
https://api.ruseo.cn/api/ip_query
接口调用前需要确认的核心配置。
/api/ip_queryip_query必填参数必须传入,示例值可直接用于联调。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
是 | string | 需要审核通过的 ApiKey。请注册账号获取API Key。 | YOUR_API_KEY |
ip |
否 | string | 要查询的IP地址,不传则默认当前访问IP。 | 8.8.8.8 |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/ip_query?key=YOUR_API_KEY&ip=8.8.8.8
curl "https://api.ruseo.cn/api/ip_query?key=YOUR_API_KEY&ip=8.8.8.8"
$url = 'https://api.ruseo.cn/api/ip_query?key=YOUR_API_KEY&ip=8.8.8.8';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/ip_query?key=YOUR_API_KEY&ip=8.8.8.8')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "ip_query",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
result.ip |
string | 查询的IP地址 | 8.8.8.8 |
result.country |
string | 国家 | 美国 |
result.province |
string | 省份/州 | California |
result.city |
string | 城市 | Mountain View |
result.isp |
string | 运营商 | Google LLC |
点击左侧“发送请求”查看结果...