gpt4 book ai didi

php - 如何解码 WooCommerce Webhook Secret?

转载 作者:行者123 更新时间:2023-12-03 15:58:04 25 4
gpt4 key购买 nike

我找不到关于使用什么算法来解码 PHP 中的 WooCommerce webhook 字段 X-Wc-Webhook-Signature 的任何信息。有人知道怎么解码吗?

谢谢!

最佳答案

扩展当前的答案,这是您需要的 PHP 代码片段:

$sig = base64_encode(hash_hmac('sha256', $request_body, $secret, true));

$secret 是你的 secret ,$request_body 是请求体,可以通过 file_get_contents('php://input'); 获取。
$sig 值应该等于 X-Wc-Webhook-Signature 请求 header 。

关于php - 如何解码 WooCommerce Webhook Secret?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44312553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com