在线调试面板(测试接口返回效果)

|

接口返回JSON数据:

服务器负载检测: 服务器检测中...
接口总调用 加载中…

一、接口基础地址

本站接口路径:https://cmun.net/api.php

二、接口1:查询指定IP信息,同时支持IPv4&IPv6查询。

功能:传入IP地址,返回该IP归属地、运营商等完整信息

请求方式:GET

请求参数:ip 字符串,必填

https://cmun.net/api.php?ip=1.1.1.1
# curl调用示例 curl https://cmun.net/api.php?ip=1.1.1.1

三、接口2:获取访问者本机公网IP

功能:无需传IP,自动获取当前访客出口公网IP

请求方式:GET

请求参数:myip=1

https://cmun.net/api.php?myip=1
# curl调用示例 curl https://cmun.net/api.php?myip=1

四、PHP对接示例代码

<?php // PHP请求接口示例 $ip = "1.1.1.1"; $apiUrl = "https://cmun.net/api.php?ip=".urlencode($ip); $json = file_get_contents($apiUrl); $data = json_decode($json,true); print_r($data); ?>

五、JavaScript网页对接示例

// JS fetch请求示例 fetch('https://cmun.net/api.php?ip=1.1.1.1') .then(res=>res.json()) .then(ret=>{ console.log(ret); })