消息快速告警

利用server酱

地址:http://sc.ftqq.com/3.version

1.查看上方网址,github授权登录,并且微信绑定即可获取key值
2.利用方糖微信公众号来返回模板消息,可以是告警信息,这里我处理成打卡时间

用php处理的方法
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function sc_send(  $text , $desp = '' , $key = '2121212adwadwadwa'  )
{
$postdata = http_build_query(
array(
'text' => $text,
'desp' => $desp
)
);

$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
return $result = file_get_contents('https://sc.ftqq.com/'.$key.'.send', false, $context);

}