Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Codeigniter 4 base项目中尝试设置Coinbase Webhook时出现问题_Php_Codeigniter 4_Coinbase Php - Fatal编程技术网

Php 在Codeigniter 4 base项目中尝试设置Coinbase Webhook时出现问题

Php 在Codeigniter 4 base项目中尝试设置Coinbase Webhook时出现问题,php,codeigniter-4,coinbase-php,Php,Codeigniter 4,Coinbase Php,我想添加一个webhook来验证和获取coinbase事件 这是我的webhook控制器 public function verifyCoinbase() { $secret = 'xxxxxxxxxxxxxxxxx'; $headerName = 'X-Cc-Webhook-Signature'; $headers = getallheaders(); $signraturHeader = isset($headers[$headerName]) ? $headers[$headerName

我想添加一个webhook来验证和获取coinbase事件

这是我的webhook控制器

public function verifyCoinbase() {
$secret = 'xxxxxxxxxxxxxxxxx';
$headerName = 'X-Cc-Webhook-Signature';
$headers = getallheaders();
$signraturHeader = isset($headers[$headerName]) ? $headers[$headerName] : null;
$payload = trim(file_get_contents('php://input'));

try {
    $event = Webhook::buildEvent($payload, $signraturHeader, $secret);
    http_response_code(200);
    echo sprintf('Successully verified event with id %s and type %s.', $event->id, $event->type);
} catch (\Exception $exception) {
    http_response_code(400);
    echo 'Error occured. ' . $exception->getMessage();
}

}
运行测试时,我收到一条错误消息,上面说

hash_equals():预期已知_字符串为字符串,给定null


试了三天。如果我能找到解决这个问题的办法,我将非常高兴。请帮忙

这个问题不是很清楚。您通常需要一个函数来验证接收到的webhook(带有事件)。文档应该指向如何验证webhook。错误是“hash_equals()”的结果为空,因此您可能没有正确计算哈希。