wusheng233喵喵ICP备案+酱酱窝存档记录


源代码: test.php

<?php
function checkDomain($domain) {
    // 初始化 cURL
    $ch = curl_init();

    // 设置 cURL 选项
    curl_setopt($ch, CURLOPT_URL, $domain);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);

    // 执行 cURL 请求并获取响应
    $response = curl_exec($ch);

    // 获取 HTTP 状态码
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    // 关闭 cURL 资源
    curl_close($ch);

    // 检查 HTTP 状态码
    if ($httpCode != 200) {
        return array(false, "网站失效");
    }

    // 使用 DOMDocument 解析 HTML
    $dom = new DOMDocument();
    @$dom->loadHTML($response);

    // 使用 DOMXPath 查找所有 a 标签
    $xpath = new DOMXPath($dom);
    $aTags = $xpath->query('//a');

    // 遍历所有 a 标签
    foreach ($aTags as $aTag) {
        $href = $aTag->getAttribute('href');
        if (strpos($href, 'annno.cn') !== false) {
            return array(true, "已悬挂链接");
        }
        if (strpos($href, 'nyaicp.xyz') !== false) {
            return array(true, "已悬挂链接");
        }
        if (strpos($href, 'www.omoi.fun') !== false) {
            return array(true, "已悬挂链接");
        }
    }

    return array(false, "未悬挂链接");
}
这个网站由wusheng233制作,生成了静态页面