Graph API和PHP SDK返回不同的结果 [英] Graph API and PHP SDK returns different results

查看:69
本文介绍了Graph API和PHP SDK返回不同的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试获取我们学校团体的成员名单.问题是,如果我使用Graph API资源管理器进行尝试,结果是可以的(具体来说,该成员的ID之一:732260790195849)


I am trying to get a list of members of our school group. The problem is, if I try it using Graph API explorer, results are ok (to be specific, one of the member's id: 732260790195849)

当我使用PHP代码尝试尝试时,ID有所不同732293256859269

When I try it using my PHP code, ID differs a little 732293256859269

我的PHP代码:

<?php
session_start();
?>
<!DOCTYPE html>
...
<?php
require('fbsdk/autoload.php');

use Facebook\FacebookSession;
...

FacebookSession::setDefaultApplication('...', '...');

$helper = new FacebookRedirectLoginHelper( '...' );

try {
  $session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
} catch( Exception $ex ) {
}

if ( isset( $session ) ) {
  $request = new FacebookRequest( $session, 'GET', '/mygroupid/members?limit=2000' );
  $response = $request->execute();

    $data = $response->getGraphObject();
    echo '<pre>', var_dump($data), '</pre>';

} else {
  echo '<a href="' . $helper->getLoginUrl() . '">Login</a>';
}

?>
</body>
</html>

我已作为该组的成员登录.
任何想法为什么会这样?感谢您的回答.

I am logged as a member of that group..
Any ideas why is this happening ? Thanks for answers.

推荐答案

您正在使用Graph Explorer检索应用程序中应用程序作用域的ID以及可能的真实(或其他作用域)ID.这是为了保护用户信息.无论如何,您检索的ID将链接到正确的人.我还要补充一点,此ID在应用程序中永远不会更改.

You're retrieving an app-scoped ID within an application and probably the real (or another scoped) ID with the Graph Explorer. This is to protect user information. In any event, the ID you retrieve will link to the correct person. I'll also add that this ID will never change within the app.

这篇关于Graph API和PHP SDK返回不同的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆