简体   繁体   English

Facebook 图 API。 如何从帖子中获得评论

[英]Facebook Graph API. How to get comment from post

Hi i have this to get comment from post it works is there is a years嗨,我有这个可以从帖子中获得评论它有效是有几年的

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

but now i have this error in facebook但现在我在 facebook 上有这个错误

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

how i can get all comment from post ?我如何从帖子中获得所有评论?

i have using your code @luschn my request with true APP ID and App Secret我使用你的代码@luschn 我的请求和真正的应用程序 ID 和应用程序秘密

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

i have this我有这个

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

i use chrome to look this error我使用 chrome 来查看这个错误

-- English is not my native language, sorry for any mistakes. -- 英语不是我的母语,如有错误请见谅。

For example:例如:

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

The most basic Access Token is an App Access Token, you can create one like this:最基本的访问令牌是一个应用程序访问令牌,你可以像这样创建一个:

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

Depending on the resource, you may need a User or Page Token though.根据资源,您可能需要用户或页面令牌。 For that, you will have to authorize the User and it gets a lot more complicated.为此,您必须授权用户,这会变得更加复杂。

More information about Access Tokens:有关访问令牌的更多信息:

您必须更改位置访问令牌和限制

https://graph.facebook.com/167416583311544_730350233684840/comments?access_token=appId|appSecret&limit=2500

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM