代码如下谢谢 ,content是内容,key换成你自己的key谢谢,别用这个测试,这个的key 我改了,请你自行用自己的key
<?php
$content = "要发送的信息";
$key = "f3ec68c8d4f08f84b75fcead6a983e";
$url = "https://app.qun.qq.com/cgi-bin/api/hookrobot_send?key=".$key;
$body = "{\"content\": [ {\"type\":0,\"data\":\"".$content."\"}]}";
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . strlen($body)
)
);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
echo "Send Over!";
?>
发表评论: