我在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。当我理解正确的文档后,应该将带有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");
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句