免费无密钥Key · 开发者对接教程 + 在线接口调试工具 | 当前本机IP:216.73.216.252
接口路径:https://ip258.cn/api.php
功能:传入IP地址,返回该IP归属地、运营商、城市、区域等完整信息
请求方式:GET
请求参数:ip 字符串,必填,无key参数
curl https://ip258.cn/api.php?ip=1.1.1.1
功能:无需传IP,自动获取当前访客出口公网IP,零参数鉴权
请求方式:GET
请求参数:myip=1
curl https://ip258.cn/api.php?myip=1
<?php // PHP请求接口示例,无需key $ip = "1.1.1.1"; $apiUrl = "https://ip258.cn/api.php?ip=".urlencode($ip); $json = file_get_contents($apiUrl); $data = json_decode($json,true); print_r($data); ?>
// JS fetch请求示例,不带密钥
fetch('https://ip258.cn/api.php?ip=1.1.1.1')
.then(res=>res.json())
.then(ret=>{
console.log(ret);
})
统一JSON格式,code=200为成功,其他状态码代表查询失败