<?php
// 填入待检测的域名列表
$domainList = array(
'google.com',
'baidu.com',
);
// 遍历域名列表进行检测
foreach ($domainList as $domain) {
$url = "https://down.ychengsnsm.com/wx/?url={$domain}";
// 发送 HTTP 请求
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
CURLOPT_SSL_VERIFYPEER => false,
));
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
// 解析响应结果
if (strpos($response, '域名被封') === false) {
// 检测域名正常
echo "域名 {$domain} 正常\n";
echo "</br>";
} else {
// 检测域名被封
echo "域名 {$domain} 被封\n";
echo "</br>";
}
}
?>
$domainList里面填域名即可,还可以自己再加短信提醒,如果是跑广点通广告的,还能自己再加自动换域名等等