我正在使用Podio PHP API,我想验证一个webhook,如下所述:https://developers.podio.com/examples/webhooks
我的服务器上有一个测试脚本:http://qvido.se/api/podio/ValidateHook.php
,其中包含以下代码:
<?php
require_once('Depend/PodioAPI.php');
require_once('Depend/config.php');
error_log("validate triggerd");
// Setup client
Podio::setup($client_id, $client_secret);
// Turn on debugging
Podio::$debug = true;
// Authenticate the application
Podio::authenticate('app', array('app_id' => MY_APP_ID, 'app_token' => 'MY_APP_TOKEN'));
switch ($_POST['type']) {
case 'hook.verify':
// Validate the webhook
PodioHook::validate($_POST['hook_id'], array('code' => $_POST['code']));
case 'item.create':
// Do something. item_id is available in $_POST['item_id']
case 'item.update':
// Do something. item_id is available in $_POST['item_id']
case 'item.delete':
// Do something. item_id is available in $_POST['item_id']
}
?>
当在Podio UI中点击Verfiy
时,它似乎不会向我的脚本发送$_POST
请求。我打开了调试模式,但podio.log文件中没有任何记录。相反,它在尝试向我的脚本发送$_POST
请求时显示了一个302错误代码。
我觉得我的剧本根本没有被调用。我该怎么做?
假设所有其他变量都定义正确,静态Podio::authenticate((方法中仍然存在错误。
只需去掉MY_APP_TOKEN:中的引号
所以
Podio::authenticate('app', array('app_id' => MY_APP_ID, 'app_token' => 'MY_APP_TOKEN'));
最好是
Podio::authenticate('app', array('app_id' => MY_APP_ID, 'app_token' => MY_APP_TOKEN));
干杯!