preface
"Server Paste", named "ServerChan" in English, is a communication software between "programmer" and "server". Say something reasonable. It is a tool to push alarms and logs from the server to the mobile phone. It only takes one minute to open and use it: Login: log in to the website with GitHub account to get a SCKEY (on the "Send Message" page) Binding: click "WeChat push" to complete binding at the same time of scanning code Message: To http://sc.ftqq.com/SCKEY.send Send a GET request and you can receive messages on WeChat
//Comment WeChat push function sc_send($comment_id) { $text='There is a new comment on the blog'; $comment = get_comment($comment_id); $desp = $comment->comment_content; $key='Your own SCKEY'; $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(' http://sc.ftqq.com/ '.$ key.'. send', false, $context); } add_action('comment_post', 'sc_send', 19, 2);
Copyright notice: This is an original article, and the copyright belongs to Rat's Blog All, please indicate the source for reprinting!
Link to this article: https://www.moerats.com/archives/57/
If the tutorial needs to be updated, or 404 appears on the related link, you can leave a comment below the article.