触发Webhook时我没有从trello收到任何有效负载

问题描述 投票:0回答:1

我在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}%

当我在此列表中添加/删除卡时,将触发我的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?

php webhooks trello
1个回答
0
投票

您应该可以使用以下方法拾取有效载荷:

$data = file_get_contents("php://input");
© www.soinside.com 2019 - 2024. All rights reserved.