gpt4 book ai didi

php - Facebook 图形 API。如何获取帖子的评论

转载 作者:行者123 更新时间:2023-12-02 21:15:21 25 4
gpt4 key购买 nike

嗨,我想从帖子中获得评论,它有效吗?还有几年

 $json = file_get_contents("http://graph.facebook.com/730350233684840/comments?limit=2500");
echo $json;

但是现在我在 facebook 中遇到了这个错误

{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}

如何获取帖子中的所有评论?

我使用了你的代码@luschn我的请求包含真实的 APP ID 和 App Secret

https://graph.facebook.com/730350233684840/comments?limit=2500&access_token=[APPIS|APPSECRT]

我有这个

{
"error": {
"message": "Invalid OAuth access token signature.",
"type": "OAuthException",
"code": 190
}
}

我使用chrome来查看这个错误

--英语不是我的母语,很抱歉有任何错误。

最佳答案

例如:

$json = file_get_contents("http://graph.facebook.com/730350233684840/comments?limit=2500&access_token=[your-access-token]");

最基本的访问 token 是应用程序访问 token ,您可以像这样创建一个:

$appAccesstoken = $appId . '|' . $appSecret;

根据资源的不同,您可能需要用户或页面 token 。为此,您必须授权用户,这会变得更加复杂。

有关访问 token 的更多信息:

关于php - Facebook 图形 API。如何获取帖子的评论,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31091862/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com