PHP语言
提示
由于GET请求只需在url上拼接head和body参数太简单了, 很多编程语言只需一句,例如php:
<?php echo file_get_contents("https://www.phprm.com/services/push/trigger/4d05f4abdb0a0c2a0269900809946903?head=".urlencode("这是标题")."&body=".urlencode("这是长内容")); ?>
1
<?php
// 通道码
$channel_code = "4d05f4abdb0a0c2a0269900809946903";
$head = "测试标题";
$body = "测试内容";
$jump_url = ""; // 点击消息跳转的链接,不需要可留空
$postdata = json_encode(
array(
'head' => $head,
'body' => $body,
'url' => $jump_url
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/json;charset=UTF-8',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$api_url = 'https://www.phprm.com/services/push/send/'.$channel_code;
$result = file_get_contents($api_url, false, $context);
echo $result;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
提示
- GET 简单调用可以用
trigger接口;POST 发送自定义head/body的 JSON 请求请使用send接口。 - 示例通道码
4d05f4...为公共体验通道,正式使用请替换成自己的通道码 (opens new window)。
如果你更倾向于使用curl库, 完全可以自己实现或者参考以下开源的三方库里的curl代码。
# 一些开源的三方库
- 如果希望使用专业推送库, 可以参考此开源项目, 【一封传话】聚合推送SDK已经提交到Github和Gitee,通过composer可以直接安装SDK:
Github: https://github.com/guanguans/notify (opens new window)
Gitee: https://gitee.com/guanguans/notify (opens new window)
- 提供博客系统新注册用户、新评论提醒插件, 可以参考插件源码或者直接在自己的网站使用:
WordPress插件: https://github.com/teakong/wordpress-tixing (opens new window) 或者 https://gitee.com/teakong/wordpress-tixing (opens new window)
Typecho插件: https://github.com/teakong/TypechoTixing (opens new window) 或者 https://gitee.com/teakong/TypechoTixing (opens new window)
其他博客或网站插件: https://github.com/teakong/liuyan-weixin (opens new window) 或者 https://gitee.com/teakong/liuyan-weixin (opens new window)
- 一行代码,集成推送和弹幕API,适用于任何网站。自动识别当前网页内容发送AI弹幕,还可以自由发布公告、历史评论推送到弹幕,包括不限于个人博客、游戏直播等场景,无需后端开箱可用;同一行脚本也能用于离线 HTML,加上
plugins=stat即可为离线 HTML 与任意网站做访问统计(PV/UV、趋势、设备与访问明细):
- 一行命令通过 push-server MCP 向用户推送消息,npx skills add teakong/push-server
Last Updated: 2026/11/02, 11:48:45