I’ve code application for Facebook just for fun but need to access friend name and profile picture. But when google, graph api request /me/friends not work anymore, because on 2.0 and higher version of open SDK it just get all friends who had been login to your app before. So it not usable for my application idea.
After that, I found Facebook SDK provide new way to get friends information is taggable_friends. It is ok for developer, tester for this app, but if you design for user, remember submit review to Facebook for permission approved.
On my case, Graph api:
GET request: me/taggable_friends?fields=picture.width(300).height(300),name
On graph api explorer, choice application firsts before test. You can change with and height for small or large picture.
PHP SDK:
[php]
$fb = new Facebook\Facebook([
‘app_id’ => APP_ID,
‘app_secret’ => APP_SECRET,
‘default_graph_version’ => ‘v2.4’,
]);
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(‘me/taggable_friends?fields=picture.width(300).height(300),name’, ACCESS_TOKEN);
} catch (Facebook\Exceptions\FacebookResponseException $e) {
echo ‘Graph returned an error: ‘ . $e->getMessage();
exit;
} catch (Facebook\Exceptions\FacebookSDKException $e) {
echo ‘Facebook SDK returned an error: ‘ . $e->getMessage();
exit;
}
$fr = $response->getGraphEdge();
foreach ($fr as $f) {
print_r($f);
}
[/php]
Have good time with code ! ^^