首页 > 解决方案 > Facebook API 用于回复业务页面上的评论

问题描述

我已经完成了所有设置,并且一切正常。我有一个弹出窗口,用户可以在其中回复他们业务页面上的评论。这也工作正常。

我的代码如下所示:

$url = "https://graph.facebook.com/v3.2/221454575852164769/comments";
$attachment =  array(
    "access_token"  => $page_access_token,
    "message"       => "Thank you so much!!",
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($attachment));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$comment = curl_exec($ch);
curl_close ($ch);
$comment = json_decode($comment, TRUE);

这工作正常。即使现在这个脚本正在运行,但问题是它返回了这个错误

Unsupported post request. Object with ID '221454575852164769' does not exist, cannot be loaded due to missing permissions, or does not support this operation

即使当我去查看 Facebook 上的评论时,Curl 收到错误,评论也已成功发布。

有什么帮助吗?

标签: facebook-graph-api

解决方案


从我标记的副本中,您会看到您可能需要将您的应用程序提交给 Facebook 以进行应用程序审查以获得权限。

https://developers.facebook.com/docs/facebook-login/permissions/v3.0

自最近引入登录审查以来,我如何测试 Facebook 应用程序?

要么是那个,要么是你输入了错误的参数/变量,因此 18 位 ID 号不正确,因为它无法引用该对象的实例。


推荐阅读