接口使用说明

1. 浏览器直接访问 (GET):

URL: https://itusu.cn/<域名或IP>

示例: https://itusu.cn/baidu.com

2. Ajax 查询 (POST):

POST URL: https://itusu.cn/

参数说明:

  • domain (必填) : 要查询的域名或 IP,例如 example.com 或 8.8.8.8

3. 命令行 curl 调用:

curl -X POST -d "domain=example.com" https://itusu.cn/

4. PHP 调用示例:

<?php
$url = "https://itusu.cn/";
$data = http_build_query(['domain' => 'example.com']);
$options = [
    'http' => [
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',
        'content' => $data,
        'timeout' => 10
    ]
];
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$json = json_decode($result, true);
if($json['status'] === 'success'){
    echo "域名: ".$json['domain']."\n";
    echo "Whois 信息:\n".$json['whois'];
}else{
    echo "错误: ".$json['message'];
}
?>
        

5. 返回 JSON 字段说明:

  • status : success / error
  • domain : 查询的域名或 IP
  • whois : Whois 查询结果 (字符串)
  • message : 错误信息,仅在 status=error 时返回

6. 返回示例:

{
    "status": "success",
    "domain": "example.com",
    "whois": "Domain Name: EXAMPLE.COM\nRegistrar: ...\nCreation Date: ..."
}
        
© itusu.cn. All rights reserved.