gplcart / webhook
允许通过发送HTTP POST有效载荷来通知外部资源关于各种系统事件
dev-master
2018-03-10 14:51 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-28 20:14:46 UTC
README
Web Hook 是一个 GPL Cart 模块,它允许通过发送HTTP POST有效载荷来通知外部资源关于各种系统事件
特性
- 可配置触发钩子
- 可配置有效载荷URL
- 数据加密
要求
- CURL
安装
- 手动下载并解压到
system/modules
,或者使用 composercomposer require gplcart/webhook
。重要:如果您手动下载了模块,请确保解压后的模块文件夹名称不包含分支/版本后缀,例如-master
。如有需要,请重命名。 - 前往
admin/module/list
并启用该模块 - 前往
admin/module/settings/webhook
并调整设置
接收有效载荷
示例设置
- URL: http://domain.com/webhook.php
- 发送者:我的酷炫网站
- 密钥:我的密钥
- 盐:我的盐
在 webhook.php
中粘贴以下代码
if(isset($_POST['sender']) && $_POST['sender'] === 'My cool site'){
$json = $_POST['data'];
if($_POST['encrypted']){
$secret = hash("sha256", 'My secret key');
$hash = substr(hash("sha256", 'My salt'), 0, 16);
$json = openssl_decrypt($json, "AES-256-CBC", $secret, 0, $hash);
}
$payload = json_decode($json, true);
print_r($payload);
}