1、企业微信设置参考我这篇博客
https://blog.csdn.net/weixin_44880442/article/details/121774231?spm=1001.2014.3001.5501
2、PHP代码
#key=企业微信机器人中的值
$webhook = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="; #这里需要修改
# curl初始化
$curl = curl_init();
#需要推送的url
curl_setopt($curl, CURLOPT_URL, $webhook);
curl_setopt($curl, CURLOPT_POST, 1);
#content必须是utf8编码
curl_setopt($curl, CURLOPT_HTTPHEADER,array('Content-Type: application/json;charset=utf-8'));
#content 为需要推送的内容
$post_data = '
{
"msgtype": "text",
"text": {
"content": "hello world"
}
}';
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
$data = curl_exec($curl);
curl_close($curl);
?>
3、效果
4、官方参数详解
https://work.weixin.qq.com/api/doc/90000/90136/91770
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。