1

Hy,

I'm need to get a user's friends (Name, unique ID, profile pic). Graph api v2.0 does not allow that if I'm know it well. Is there any workaround, or solution, to get the necessary data?

I'm working with PHP SDK.

Thanks, Dave.

Dávid Pörös
  • 83
  • 2
  • 11
  • This was removed from API 2.0 for a reason – and that would be quite pointless, if there was a “workaround”. – CBroe May 29 '14 at 00:54

2 Answers2

3

It's no longer possible to get all friends of a certain user with Graph API v2.0. Furthermore, all friend-related permissions have been removed.

See retrieve full list of friends using facebook API

Community
  • 1
  • 1
Tobi
  • 31,405
  • 8
  • 58
  • 90
  • Thanks! Do you know any solution, to make an app, where the user can vote for his friends? In the app I need to identify the voted friend, with a unique ID, so the user cannot vote more than once a day. – Dávid Pörös May 29 '14 at 05:34
1

Yes, you can get the list of your friends, but your friends first need to access your app, and grant permission first. You may ask permission with the following code ->

$params = array( 'scope' => 'public_profile, user_friends');
$login_url = $facebook->getLoginUrl($params);
echo 'Please <a href="' . $login_url . '">login.</a>';

And then this to print your list ->

$fr = $facebook->api('/me/friends','GET');
foreach ($fr['data'] as $value) {
echo "<pre>";
         echo "Friend Name: ";
         print_r($value['name']);
         echo "<br />";
}

Please note, this is when you use the SDK v3

codemode
  • 350
  • 2
  • 4
  • 22
  • The `/me/friends` only get the friends who already used the app in Graph API v2.0. Am I wrong? – Dávid Pörös May 29 '14 at 05:37
  • Correct. With the restrictions of fecebook, we can now get the list of friends only who use your app. Sadly, this is the only way. – codemode May 30 '14 at 01:10