cURL
curl "https://api.ruseo.cn/api/port_check?host=baidu.com&port=443&type=1"
检测指定主机TCP端口开放状态,支持国内、香港、美国三个检测节点。
https://api.ruseo.cn/api/port_check
接口调用前需要确认的核心配置。
/api/port_checkport_check必填参数必须传入,示例值可直接用于联调。
免费API不强制要求API Key,但如果您希望统计个人调用次数,请在请求时附加参数 key=您的API_KEY。
注册账号后即可获得API Key。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
否 | string | 可选参数:携带此参数可统计您的个人调用次数。请注册账号获取API Key。 | YOUR_API_KEY |
host |
是 | string | 目标主机IP地址或域名 | baidu.com |
port |
否 | integer | 端口号,0-65535,默认80 | 443 |
type |
否 | integer | 检测节点:1=国内,2=香港,3=美国,默认国内 | 1 |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/port_check?host=baidu.com&port=443&type=1
curl "https://api.ruseo.cn/api/port_check?host=baidu.com&port=443&type=1"
$url = 'https://api.ruseo.cn/api/port_check?host=baidu.com&port=443&type=1';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/port_check?host=baidu.com&port=443&type=1')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "port_check",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
code |
integer | 状态码:200=成功,400=参数错误,500=服务器错误 | 200 |
msg |
string | 状态描述:开放/关闭/未知,或错误信息 | 开放 |
data |
object | 端口检测结果 | {} |
data.host |
string | 检测的目标主机IP或域名 | baidu.com |
data.port |
integer | 检测的端口号 | 443 |
data.state |
string | 端口状态:on=开放,off=关闭,unknown=未知 | on |
data.state_text |
string | 端口状态中文描述:开放/关闭/未知 | 开放 |
data.check_node |
string | 检测节点:国内/香港/美国 | 国内 |
data.checked_at |
string | 检测时间,格式 Y-m-d H:i:s | 2026-05-27 14:30:00 |
点击左侧“发送请求”查看结果...