Reputation: 94
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;
}
}
}
?>
Upvotes: 0
Views: 476