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

我在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","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?

abc121212121212 回答:触发Webhook时,我没有从trello收到任何有效载荷

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

$data = file_get_contents("php://input");
本文链接:https://www.f2er.com/3121190.html

大家都在问