1.主要文件,访问该页面,该页面根据“验证页面”的返回结果设置本文件的返回状态 header('HTTP/1.1 '.$code.' '.$_status[$code])
复制代码 代码如下:
<?php
ini_set('max_execution_time', 120);
include("CheckConfig.php");
function send_http_status($code) {
static $_status = array(
// Informational 1xx
=> 'Continue',
=> 'Switching Protocols',
// Success 2xx
=> 'OK',
=> 'Created',
=> 'Accepted',
=> 'Non-Authoritative Information',
=> 'No Content',
=> 'Reset Content',
=> 'Partial Content',
// Redirection 3xx
=> 'Multiple Choices',
=> 'Moved Permanently',
=> 'Moved Temporarily ', // 1.1
=> 'See Other',
=> 'Not Modified',
=> 'Use Proxy',
// 306 is deprecated but reserved
=> 'Temporary Redirect',
// Client Error 4xx
=> 'Bad Request',
=> 'Unauthorized',
=> 'Payment Required',
=> 'Forbidden',
=> 'Not Found',
=> 'Method Not Allowed',
=> 'Not Acceptable',
=> 'Proxy Authentication Required',
=> 'Request Timeout',
=> 'Conflict',
=> 'Gone',
=> 'Length Required',
=> 'Precondition Failed',
=> 'Request Entity Too Large',
=> 'Request-URI Too Long',
=> 'Unsupported Media Type',
=> 'Requested Range Not Satisfiable',
=> 'Expectation Failed',
// Server Error 5xx
=> 'Internal Server Error',
=> 'Not Implemented',
=> 'Bad Gateway',
=> 'Service Unavailable',
=> 'Gateway Timeout',
=> 'HTTP Version Not Supported',
=> 'Bandwidth Limit Exceeded'
);
if(array_key_exists($code,$_status)) {
header('HTTP/1.1 '.$code.' '.$_status[$code]);
}
}
function GetStatusCode($url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url); //设置URL
curl_setopt($curl, CURLOPT_HEADER, 1); //获取Header
curl_setopt($curl,CURLOPT_NOBODY,true); //Body就不要了吧,我们只是需要Head
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //数据存到成字符串吧,别给我直接输出到屏幕了
$data = curl_exec($curl); //开始执行啦~
$HttpCode =curl_getinfo($curl,CURLINFO_HTTP_CODE); //我知道HTTPSTAT码哦~
curl_close($curl); //用完记得关掉他
return $HttpCode;
}
function ResetUrl($url)
{
if(strpos($url,"?")>0)
$url.="&rnd";
else
$url.="?rnd";
$url.=rand();
return $url;
}
function ShowStateInfo($UrlArr,$MailPara)
{
$count=count($UrlArr);
if(isset($_REQUEST["start"]))
{
$start=$_REQUEST["start"]*1;
}
else
{
$start=1;
}
if(isset($_REQUEST["end"]))
{
$end=$_REQUEST["end"]*1;
}
else
{
$end=$start;
}
$start=$start-1;
$end=$end-1;
if($start<0)
{
$start=0;
}
if($start>=0 && $start<$count)
{
if($end>=$count)
{
$end=$count-1;
}
if($end<$start)
{
$end=$start;
}
$sTime=date("Y/m/d H:m:s");
echo "开始时间".$sTime."<br/>";
echo "检测结果<br />";
for($i=$start;$i<=$end;$i++)
{
$url=ResetUrl($UrlArr[$i]);
$state=GetStatusCode($url);
echo " ".$state ." => <a href='http://".$url."' target='_blank'>".$url."<a>";
if($state!="200")
{
echo " <span style='color:red;font-weight:bold'>本条访问出错!</span><br/>";
send_http_status($state);
//发邮件
require("Mail.php");
$MailPara["Subject"]="网站监控结果";
$MailPara["Body"]="错误信息:状态-><span style='color:red;font-weight:bold'>".$state."</span><br/>地址:".$url;
SendResultMail($MailPara);
break;
}
echo "<br/>";
}
$eTime=date("Y/m/d H:m:s");
echo "结束时间".$eTime."<br/>";
}
}
ShowStateInfo($UrlArr,$MailPara);
?>
2.邮件
复制代码 代码如下:
function SendResultMail($MailPara)
{
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->CharSet = $MailPara["CharSet"];
$mail->IsSMTP();
$mail->Host = $MailPara["Host"];
$mail->Port = $MailPara["Port"];
$mail->SMTPAuth = true;
$mail->Username = $MailPara["FromMail"];
$mail->Password = $MailPara["FromMailPassword"];
$mail->From = $MailPara["FromMail"];
$mail->FromName = $MailPara["FromMailName"];
foreach($MailPara["To"] as $toMail)
{
$mail->AddAddress($toMail["ToMail"], $toMail["ToMailName"]);
}
$mail->Subject = $MailPara["Subject"];
$mail->Body = $MailPara["Body"];
$mail->AltBody = $MailPara["AltBody"];
if(!$mail->Send())
{
echo "邮件发送失败. <p>";
echo "错误原因: " . $mail->ErrorInfo ."<br/>";
exit;
}
echo "邮件发送成功<br/>";
}
3.配置文件
复制代码 代码如下:
<?php
$UrlArr=array(
"localhost/test/281892.shtml",
"localhost/test/all-229-1-221.shtml",
"localhost/testclass/all-254-1-1.shtml",
"localhost/test/cheng/bd/1988478.html",
"localhost/test/asd/2066495.html"
);
//邮箱发送相关信息
$MailPara=array(
"CharSet"=> "GB2312",
"Host"=> "smtp.exmail.qq.com", // 邮箱服务地址
"Port"=>25,
"FromMail"=> "fdsafdsafd@fdasfds.com", // 发件人邮箱地址
"FromMailPassword"=> "*********", // 发件人邮箱密码
"FromMailName"=> "检测", //发件人称呼
"To"=>array(
array(
"ToMail"=>"defdafdsafdsafdf@qq.com", //收件人邮箱地址
"ToMailName"=> "bqq", //收件人称呼
),
array(
"ToMail"=>"abfdsafdsafdsafc@gmail.com", //收件人邮箱地址
"ToMailName"=> "agmail", //收件人称呼
)
),
"Subject"=> "", //邮件标题
"Body"=> "", //邮件内容
"AltBody"=> "附加信息" //附加信息,可以省略
);
?>
邮件主要使用"phpmailer",点击下载
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新日志
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]