How to get the list of groups and pages of an user with graph api?

自作多情 提交于 2019-12-13 07:13:14

问题


I'm using graph api but I can't list the pages and groups of an user.

First, for the permissiones, in the scope, I use: 'scope' => 'publish_stream,user_groups,user_about_me,user_interests,friends_groups,friends_interests,friends_about_me',

and then, when I try the next code, the value of $ct is 0

<?php
session_start();
require 'config.php';
require 'facebook.php';
$facebook = new Facebook(array(
'appId'  => $fb_app_id,
'secret' => $fb_secret,
'cookie' => true,
));
$user = $facebook->getUser();
$info = $facebook->api( '/me/groups', 'GET', array( 'access_token=' => $access_token ) );
$ct = count( $info['data'] );
echo $ct;
?>

回答1:


This may be a silly question, but are you sure:

  • The user is actually in some groups (many users are not)

  • You definitely have the user_groups permission (check with a call to /me/permissions)



来源:https://stackoverflow.com/questions/8328778/how-to-get-the-list-of-groups-and-pages-of-an-user-with-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!