当我的 webhook 被触发时,我没有收到来自 trello 的任何负载

I do not receive any payload from trello when my webhook is triggered

我在 trello 中为列表创建了一个 webhook:

curl -X POST -H "Content-Type: application/json" \
https://api.trello.com/1/tokens/$TRELLO_TOKEN/webhooks/ \
-d '{
  "key": "$TRELLO_API_KEY",
  "callbackURL": "https://at.foobar.com/trello-whook.php",
  "idModel":"5d9511856b7586142414762b",
  "description": "My first webhook"  
}'

我得到的答案是:

{"id":"5dc9cded49bf251341c6d32c","description":"My first webhook","idModel":"5d9511856b7586142414762b","callbackURL":"https://at.foobar.com/trello-whook.php","active":true,"consecutiveFailures":0,"firstConsecutiveFailDate":null}%

当我 add/delete 此列表中的卡片时,我的 webhook 被触发。当我理解 documentation 正确时,我应该得到一个带有 JSON 的 HTTP POST 到我的 webhook。但是我在我的日志文件中没有看到任何负载...

这是我的 trello-webhook.php 代码:

<?php
ini_set( "log_errors", 1);
ini_set( "error_log", "/var/log/trello-scripts.log");
error_log(  "trello-whook was called" );
$output = print_r( $_POST, true );
error_log( $output );
?>

这是我的 /var/log/trello-scripts.log 的输出:

[11-Nov-2019 21:25:54 UTC] trello-whook was called
[11-Nov-2019 21:25:54 UTC] Array
(
)

我哪里理解错了?我如何获得 trello JSON?

您应该能够通过以下方式获取有效载荷:

$data = file_get_contents("php://input");