简体   繁体   中英

unable to fetch data from close group using Facebook graph api

I am unable to fetch closed group posts from facebook. As I'm the member of that group but i cant access it via my access token in graph api. But I can fetch all the data from open groups with my access token in which i am a member.

I am using this url: [ https://graph.facebook.com/my-group-id/feed?access_token=my-access-token]

My Code:

<?php
   $group = array(
    array('id'=>'xxxx','name'=>'zzzzz'),
    array('id'=>'xxx' , 'name'=>'yyyy'),
    );

  $access_token = 'my token';

  $n = count($group);
  $i = -1;

  while($n--){
        $i++;
        $add = 'https://graph.facebook.com/'.$group[$i]['id'].'/feed?fields=id,name,story,message,updated_time&access_token='.$access_token;
        $json = file_get_contents($add);
        $data = json_decode($json);
        if($json){
            foreach($data->data as $item){
              $post_id = $item->id;
              $name = $item->name;
              $date = $item->updated_time;
              $story = $item->story;
              $message = $item->message;
            }
        }
  }
?>

Facebook has discontinued allowing group feeds (non-Public) on Graph API since app version 2.4.

If you wish to use this feature, you need an application of version 2.1 - 2.3 for the time being. Usage and API documentation can be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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