Php 如何使用精确的在线Webhook订阅

Php 如何使用精确的在线Webhook订阅,php,exact-online,picqer-exact-php-client,Php,Exact Online,Picqer Exact Php Client,我可以使用准确的在线API订阅webhook,但我无法从webhook通知获得对CallbackURL的响应 我使用以下请求订阅: $subscription = new \Picqer\Financials\Exact\WebhookSubscription($connection); $subscription->deleteSubscriptions(); $subscription->CallbackURL = $callback; $subscription->Top

我可以使用准确的在线API订阅webhook,但我无法从webhook通知获得对CallbackURL的响应


我使用以下请求订阅:

$subscription = new \Picqer\Financials\Exact\WebhookSubscription($connection);
$subscription->deleteSubscriptions();
$subscription->CallbackURL = $callback;
$subscription->Topic = $topic;
$subscription->save(); 

请给我建议,通过准确的在线php API获得webhook通知

成功注册webhook后

我找到了如何在CallbackURL中处理请求的解决方案

$input = file_get_contents('php://input');
您将得到json响应

$requestContent= file_get_contents('php://input');  // (this is json response)
$webhookSecret='XXXXXXXXXXXXXXXX'; //your webhook Secret key

$returnvalue=authenticate($requestContent,$webhookSecret); // this will get either true/false
function authenticate($requestContent, $webhookSecret)
    {
        $matches = [];
        $matched = preg_match('/^{"Content":(.*),"HashCode":"(.*)"}$/', $requestContent, $matches);

        if ($matched === 1 && isset($matches[1]) && isset($matches[2])) {
            return $matches[2] === strtoupper(hash_hmac('sha256', $matches[1], $webhookSecret));
        }
        return false;
    }
按照下面的示例,您可以验证您的webhook响应

$requestContent= file_get_contents('php://input');  // (this is json response)
$webhookSecret='XXXXXXXXXXXXXXXX'; //your webhook Secret key

$returnvalue=authenticate($requestContent,$webhookSecret); // this will get either true/false
function authenticate($requestContent, $webhookSecret)
    {
        $matches = [];
        $matched = preg_match('/^{"Content":(.*),"HashCode":"(.*)"}$/', $requestContent, $matches);

        if ($matched === 1 && isset($matches[1]) && isset($matches[2])) {
            return $matches[2] === strtoupper(hash_hmac('sha256', $matches[1], $webhookSecret));
        }
        return false;
    }

您能告诉我们您到目前为止一直在尝试做什么吗?我使用以下请求订阅:$subscription=new\Picqer\Financials\Exact\WebhookSubscription($connection);$subscription->deleteSubscriptions();$subscription->CallbackURL=$callback;$subscription->Topic=$Topic;$subscription->save();我想在CallbackUrl上存储webhook通知响应您是否阅读了developers.exactonline.com上的手册?你应该设置一个具有证书和正确域名的接收者。是的,我给出了正确的域名。我遵循了这个SDK链接