我是Facebook API集成的新手。 我能够获得用户的个人资料以及使用我的应用程序的朋友列表。但是,我想要用户登录我的APP和他/她的朋友之间的共同朋友列表。 我附上我使用的代码:
//facebook application configuration
$fbconfig['appid' ] = "636631533131524";
$fbconfig['secret'] = "d325de230128984562kba45341e574f0";
try{
include_once ('.\facebook-php-sdk-master-master\src\facebook.php');
}
catch(Exception $o){
print_r($o);
}
$facebook = new Facebook(array(
'appId' => $fbconfig['appid'],
'secret' => $fbconfig['secret'],
'cookie' => true,
));
$user = $facebook->getUser();
$loginUrl = $facebook->getLoginUrl(
array(
'scope' => 'email'
)
);
if ($user) {
try {
$user_profile = $facebook->api('/me');
$user_friends = $facebook->api('/me/friends');
$mutual_friends = $facebook->api('/me/mutualfriends/844865302256121');
$access_token = $facebook->getAccessToken();
} catch (FacebookApiException $e) {
d($e);
$user = null;
}
}
请告诉我怎么做这个过程?
由于
答案 0 :(得分:0)
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
$session,
'GET',
'/{user-id}',
array (
'fields' => 'context.fields(mutual_friends)',
)
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */