简体   繁体   English

我如何从Facebook上带有访问令牌的帖子中获取评论

[英]how do i get the comments from a post in facebook with an access token

Please help me out here, i am a noob going nuts on Facebook API calls... 请在这里为我提供帮助,我对Facebook API调用不满意...

I want to retrieve the comments of a post that i posted on another users fan or personal page. 我想检索我在其他用户粉丝或个人页面上发布的帖子的评论。

I have its long lived access token. 我有它的长期访问令牌。 I debugged it with the Facebook access token debugger to see if it is valid, and it expires in 2 months. 我使用Facebook访问令牌调试器对其进行了调试,以查看其是否有效,并在2个月后到期。

I have the following permissions: public_profile , basic_info , rsvp_event , email , read_friendlists , manage_pages , publish_actions , user_birthday , user_relationships , user_location , user_likes , user_activities , user_website , user_friends & user_about_me 我具有以下权限: public_profilebasic_inforsvp_eventemailread_friendlistsmanage_pagespublish_actionsuser_birthdayuser_relationshipsuser_locationuser_likesuser_activitiesuser_websiteuser_friendsuser_about_me

I would like to get the comments of a post the id is 100006454706505_1649297628628711 which is returned to me by a post i previously made. 我想获得ID为100006454706505_1649297628628711的帖子的评论,该帖子由我之前发的帖子返回给我。

What is the facebook api call i need to make to read the comments and likes of that post? 阅读该帖子的评论和喜欢,我需要进行什么Facebook API调用? It looks so simple a question.... 这个问题看起来很简单。

$facebook = new Facebook(array(  
        'appId' => __FB_APP_ID__,
        'secret' => __FB_SECRET_APP_ID__
    ));
$result = $facebook->api('/me/posts', array('access_token' => $access_token, 'limit' => 100));

output: 输出:

data: array = 
    0: array = 
      id: string = 100006454706505_1613262798898861
      from: array = 
        id: string = 100006454706505
        name: string = Kc Hessels
      story: string = Kc Hessels likes a link.
      story_tags: array = 
        0: array = 
          0: array = 
            id: string = 100006454706505
            name: string = Kc Hessels
            offset: long = 0
            length: long = 10
            type: string = user
      privacy: array = 
        value: string = 
      type: string = status
      created_time: string = 2014-05-26T23:43:51+0000
      updated_time: string = 2014-05-26T23:43:51+0000
    1: array = 
      id: string = 100006454706505_1607721539452987
      from: array = 
        id: string = 100006454706505
        name: string = Kc Hessels
      story: string = Kc Hessels and Elizabeth Garita are now friends.
      story_tags: array = 
        0: array = 
          0: array = 
            id: string = 100006454706505
            name: string = Kc Hessels
            offset: long = 0
            length: long = 10
            type: string = user
        15: array = 
          0: array = 
            id: string = 100007895078419
            name: string = Elizabeth Garita
            offset: long = 15
            length: long = 16
            type: string = user
      actions: array = 
        0: array = 
          name: string = Comment
          link: string = https://www.facebook.com/100006454706505/posts/1607721539452987
      privacy: array = 
        value: string = 
      type: string = status
      status_type: string = approved_friend
      created_time: string = 2014-05-19T19:37:46+0000
      updated_time: string = 2014-05-19T19:37:46+0000
    2: array = 
      id: string = 100006454706505_1578102925748182
      from: array = 
        id: string = 100006454706505
        name: string = Kc Hessels
      story: string = Kc Hessels and Nuemy Del Carmen Ramirez Varela are now friends.
      story_tags: array = 
        0: array = 
          0: array = 
            id: string = 100006454706505
            name: string = Kc Hessels
            offset: long = 0
            length: long = 10
            type: string = user
        15: array = 
          0: array = 
            id: string = 100006041622188
            name: string = Nuemy Del Carmen Ramirez Varela
            offset: long = 15
            length: long = 31
            type: string = user
      actions: array = 
        0: array = 
          name: string = Comment
          link: string = https://www.facebook.com/100006454706505/posts/1578102925748182
      privacy: array = 
        value: string = 
      type: string = status
      status_type: string = approved_friend
      created_time: string = 2014-04-11T17:25:51+0000
      updated_time: string = 2014-04-11T17:25:51+0000
    3: array = 
      id: string = 100006454706505_1534063350152140
      from: array = 
        id: string = 100006454706505
        name: string = Kc Hessels
      story: string = Kc Hessels is now friends with Jocseline Kassandra Ulate and Monte Campana Carros.
      story_tags: array = 
        0: array = 
          0: array = 
            id: string = 100006454706505
            name: string = Kc Hessels
            offset: long = 0
            length: long = 10
            type: string = user
        31: array = 
          0: array = 
            id: string = 100001919869875
            name: string = Jocseline Kassandra Ulate
            offset: long = 31
            length: long = 25
            type: string = user
        61: array = 
          0: array = 
            id: string = 100007783835968
            name: string = Monte Campana Carros
            offset: long = 61
            length: long = 20
            type: string = user
      privacy: array = 
        value: string = 
      type: string = status
      status_type: string = approved_friend
      created_time: string = 2014-02-20T17:42:25+0000
      updated_time: string = 2014-02-20T17:42:25+0000
    4: array = 
      id: string = 100006454706505_1528673807357761
      from: array = 
        id: string = 100006454706505
        name: string = Kc Hessels
      story: string = Kc Hessels and Icam Capacitaciones are now friends.
      story_tags: array = 
        0: array = 
          0: array = 
            id: string = 100006454706505
            name: string = Kc Hessels
            offset: long = 0
            length: long = 10
            type: string = user
        15: array = 
          0: array = 
            id: string = 100004980821986
            name: string = Icam Capacitaciones
            offset: long = 15
            length: long = 19
            type: string = user
      actions: array = 
        0: array = 
          name: string = Comment
          link: string = https://www.facebook.com/100006454706505/posts/1528673807357761
      privacy: array = 
        value: string = 
      type: string = status
      status_type: string = approved_friend
      created_time: string = 2014-02-11T18:29:16+0000
      updated_time: string = 2014-02-11T18:29:16+0000
    5: array = 
      id: string = 100006454706505_1525634190995056
      from: array = 
        id: string = 100006454706505
        name: string = Kc Hessels
      story: string = Kc Hessels likes Hotel Club & Resort Monte Campana and Coupon-promotions.
      story_tags: array = 
        0: array = 
          0: array = 
            id: string = 100006454706505
            name: string = Kc Hessels
            offset: long = 0
            length: long = 10
            type: string = user
        17: array = 
          0: array = 
            id: string = 168932636493309
            name: string = Hotel Club & Resort Monte Campana
            offset: long = 17
            length: long = 33
            type: string = page
        55: array = 
          0: array = 
            id: string = 1384288225125264
            name: string = Coupon-promotions
            offset: long = 55
            length: long = 17
            type: string = page
      privacy: array = 
        value: string = 
      type: string = status
      application: array = 
        name: string = Pages
        id: string = 2530096808
      created_time: string = 2014-02-06T20:55:28+0000
      updated_time: string = 2014-02-06T20:55:28+0000
    6: array = 
      id: string = 100006454706505_1524425311115944
      from: array = 
        id: string = 100006454706505
        name: string = Kc Hessels
      story: string = Kc Hessels likes Coupon-promotions and 2 other Pages.
      story_tags: array = 

( i feel like i miss the bloody obvious) (我觉得我想念流血的明显)

OK, after fiddling somewhat with it, i found the answer... I get a lot of data, and one piece of data contains the post. 好吧,经过一番摆弄之后,我找到了答案……我得到了很多数据,并且其中一个数据包含了帖子。

Is there a way to get the post directly, without iterating the whole feed ? 有没有一种方法可以直接获得该帖子,而无需重复整个提要?

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

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