Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 需要在Facebook Webhooks中捕获评论通知_Php_Facebook_Facebook Graph Api_Facebook Webhooks - Fatal编程技术网

Php 需要在Facebook Webhooks中捕获评论通知

Php 需要在Facebook Webhooks中捕获评论通知,php,facebook,facebook-graph-api,facebook-webhooks,Php,Facebook,Facebook Graph Api,Facebook Webhooks,我有多个商业Facebook页面。我想在Webhooks中为所有页面设置回调URL,以获得评论和评级 当有人在任何页面上给出评论和评级时。我应该在我们的服务器上从webhooks获得通知 有可能通过Webhook获得评论和评级吗 首先,我使用verifytoken选项成功验证了用户Webhooks订阅的callbackUrl,如下所示 下面是我用来获取响应的代码。在验证回调URL时,我得到了$chanllenge和$verify_令牌的响应 $challenge = $_REQUEST['hu

我有多个商业Facebook页面。我想在Webhooks中为所有页面设置回调URL,以获得评论和评级

当有人在任何页面上给出评论和评级时。我应该在我们的服务器上从webhooks获得通知

有可能通过Webhook获得评论和评级吗

首先,我使用verifytoken选项成功验证了用户Webhooks订阅的callbackUrl,如下所示

下面是我用来获取响应的代码。在验证回调URL时,我得到了$chanllenge和$verify_令牌的响应

$challenge = $_REQUEST['hub_challenge'];
$verify_token = $_REQUEST['hub_verify_token'];
if ($verify_token === 'my_custom_token') {
    $filePath = realpath('Dump/') . '/' . "facebook_if_inbound.txt";
    $file = fopen($filePath, "a+");
    $data = file_get_contents("php://input");
    $events = json_decode($data, true);
    fwrite($file, print_r($challenge.$verify_token.$events, true));
    fclose($file);
}else{
    $filePath = realpath('Dump/') . '/' . "facebook_else_inbound.txt";
    $file = fopen($filePath, "a+");
    $data = file_get_contents("php://input");
    $events = json_decode($data, true);
    fwrite($file, print_r($challenge.$challenge.$events, true));
    fclose($file);
}


$filePath = realpath('Dump/') . '/' . "facebook_response_inbound.txt";
$file = fopen($filePath, "a+");
fwrite($file, print_r($_POST, true));
fclose($file);
但是,当我试图订阅喜欢的东西时,请先命名并尝试获得响应,Webhooks URL不会提供任何信息


注意:我的应用程序处于实时模式。

我遇到了相同的问题。我遇到了相同的问题。