小编ine*_*aez的帖子

如何创建一个网络挂钩?

因此,我正在使用Tropo和Nexmo创建一个click2call应用程序,此时,我需要设置Webhook的帮助。它们都提供了一个指向网络挂钩的地方,但是现在,我不知道在其中包括什么。它是一个php文件吗?还是json?我已经尝试创建一个php,并具有以下内容:

<?php
    header('Content-Type: application/json');
    ob_start();
    $json = file_get_contents('php://input'); 
    $request = json_decode($json, true);
    $action = $request["result"]["action"];
    $parameters = $request["result"]["parameters"];
    $output["contextOut"] = array(array("name" => "$next-context", "parameters" =>
    array("param1" => $param1value, "param2" => $param2value)));
    $output["speech"] = $outputtext;
    $output["displayText"] = $outputtext;
    $output["source"] = "whatever.php";
    ob_end_clean();
    echo json_encode($output);
?>
Run Code Online (Sandbox Code Playgroud)

以后如何从Webhook检索信息并将其存储在数据库中?我已经看过代码片段,但是我不知道在哪里包括它……它是在我的api中,还是在我的webhook指向的php文件中?先感谢您。

php webhooks

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

php ×1

webhooks ×1