前段时间不知道为什么一到凌晨 魔门云就开始不定时歇菜,估计是半夜没人维护机器就崩了吧2333
不过就那么歇菜也不是个办法咯,于是就想定时监控这魔门云状态 gg了就停止解析 本来是准备用cloudxns里的监控,后来...cloudxns不支持https监控 而且魔门云有时候虽然gg了但是状态码有时候还会是200或者301
然后就看了下cloudxns提供的api 文档还算简洁...不过PHPSDK不想说什么,智障!!没事还要装拓展...
<?php
function callInterfaceCommon($URL,$type,$params,$headers){
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// 对认证证书来源的检查
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在
if( !empty( $headers)){
curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers);
}else {
curl_setopt ($ch, CURLOPT_HTTPHEADER, array('Content-type: text/json'));
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
switch ($type){
case "GET" : curl_setopt($ch, CURLOPT_HTTPGET, true);break;
case "POST": curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);break;
case "PUT" : curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);break;
case "DELETE":curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);break;
}
$file_contents = curl_exec($ch);//获得返回值
curl_close($ch);
return $file_contents;
}
function domain($status){
do{
$url = 'https://www.cloudxns.net/api2/record/pause';
$api_key = '';//cloudxns的api_key
$data = json_encode(array('id'=>3550589,'domain_id'=>112993,'status'=>$status));
$secret_key = '';//cloudxns的secret_key
$headers=array( "API-KEY:$api_key",
"API-REQUEST-DATE:".date(),
"API-HMAC:".md5($api_key.$url.$data.date().$secret_key)
);
$response = callInterfaceCommon($url, 'POST',$data,$headers);
$json = json_decode($response,true);
}while($json['message']!='success');
}
function http($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
$con = http('魔门云预览链接+文件路径');
if($con==date('D')){
if(file_get_contents('status')=='no'){
domain(1);
}
file_put_contents('status','ok');
echo 'ok';
}else{
if(file_get_contents('status')=='ok'){
domain(0);
}
echo 'no';
file_put_contents('status','no');
}
?>
魔门云预览链接+文件路径 放置一个用以输出特定内容的php文件 例如echo date('D') 我这里就是用这个咯
毫无技术可言,不过还算靠谱 cloudxns的API千万不要频繁访问,会被当作CC 然后IP...
126086 313439Hey I was just seeking at your website in Firefox and the image at the top of the link cant show up properly. Just thought I would let you know. 783932
2018年8月15日 22:5036038 149764hello, i came in to learn about this topic, thanks alot. will put this internet site into my bookmarks. 432680
2018年8月14日 15:49再回来说一句话,魔门云现在好坑啊,以前挺好的,客服发现你频繁开关都主动找你,
2017年8月21日 07:41体验了一下,节点少,卡卡的
2017年8月17日 18:53恩,现在改的节点好坑
2017年8月18日 09:49大佬就爱开玩笑 技术贼6
2017年8月16日 13:39(。ò ∀ ó。)
2017年8月18日 09:50暂时放弃魔门云
2017年8月15日 13:02已放弃魔门云
2017年8月15日 13:0023333
2017年8月18日 09:47你这句“毫无技术可言”就让我自卑了。。。
2017年8月14日 18:19然而我已经不用魔门了,天天gg
2017年8月12日 17:23