如何使用graph api获取用户的组和页面列表?
我正在使用图形 api,但无法列出用户的页面和组。
首先,对于权限,在范围内,我使用: '范围' => 'publish_stream,user_groups,user_about_me,user_interests,friends_groups,friends_interests,friends_about_me',
然后,当我尝试下一个代码时, $ct 的值为 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;
?>
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;
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是一个愚蠢的问题,但您确定:
用户实际上在某些组中(许多用户不在)
您肯定拥有 user_groups 权限(通过调用
/me/permissions
进行检查)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
)