群晖通知发送到微信

只需要注册个企业微信就可以用 不需要公网IP固定IP有网就行

https://work.weixin.qq.com/

http://192.168.3.63:998/index.php?num=777&passwd=123&title=%40%40TEXT%40%40

<?php
$num = $_GET['num'];
$passwd = $_GET['passwd'];
$content = $_GET['title'];
$msg = $_GET['description'];
$url = $_GET['null.com'];
function curlPost($url,$data=""){   
    $ch = curl_init();
    $opt = array(
            CURLOPT_URL     => $url,            
            CURLOPT_HEADER  => 0,
            CURLOPT_POST    => 1,
            CURLOPT_POSTFIELDS      => $data,
            CURLOPT_RETURNTRANSFER  => 1,
            CURLOPT_TIMEOUT         => 20
    );
    $ssl = substr($url,0,8) == "https://" ? TRUE : FALSE;
    if ($ssl){
        $opt[CURLOPT_SSL_VERIFYHOST] = 1;
        $opt[CURLOPT_SSL_VERIFYPEER] = FALSE;
    }
    curl_setopt_array($ch,$opt);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
$corpid="11111";       //企业id
$corpsecret="11111";       //企业secret
$Url="http://wxts.geekxw.top/cgi-bin/gettoken?corpid=$corpid&corpsecret=$corpsecret";
$res = curlPost($Url);
$ACCESS_TOKEN=json_decode($res)->access_token;
$Url="http://wxts.geekxw.top/cgi-bin/message/send?access_token=$ACCESS_TOKEN";
$data="{\"touser\":\"@all\",\"msgtype\":\"text\",\"agentid\":1000004,\"text\":{\"content\":\"$content\n$msg$url\"},\"safe\":0}"; //此处ID需要修改,1000004修改为自己应用id
$res = curlPost($Url,$data);
$errmsg=json_decode($res)->errmsg;
if($errmsg==="ok"){
    echo "发送成功
    by:小陈折腾日记!
    B站:https://space.bilibili.com/22447499";
}else{
    echo "by:小陈折腾日记!
    B站:https://space.bilibili.com/22447499
    发送失败,".$errmsg;
}
?>

效果如图

图片[1]-群晖通知发送到微信-小陈折腾日记
© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享
评论 共1条
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片
    • 头像B站粉丝0