Reputation: 45
I've already read about the new facebook sdk for php, it talks about you cannot retrieve your friends information any more, and it saids about inviting friends, etc. But actually i used an app that gets some random friends names, and is not a game app, I need exactly the same, random friend names, regards.
Upvotes: 0
Views: 2325
Reputation: 15457
There is a new API endpoint that can be used to get friend names. The new /me/taggable_friends
friends API call is what you can use:
/v2.0/me/taggable_friends
The response will include friend names, profile picture and an encrypted ID that can be used with tagging API calls. See the documentation here.
Using the JS API, you can do something like:
FB.login(function(){
FB.api('/me/taggable_friends', 'get', function( response ) {
console.log( response );
} );
} );
Using PHP:
$taggable = (new FacebookRequest( $session, 'GET', '/me/taggable_friends' ))->execute()->getGraphObject()->asArray();
echo '<pre>' . print_r( $taggable, 1 ) . '</pre>';
See the full PHP example here.
You have to get this permission reviewed to use it with end-users. If you don't, you'll see a message like:
(#10) To use taggable_friends on behalf of people who are not admins, developers and testers of your app, your use of this endpoint must be reviewed and approved by Facebook. To submit this feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review
EDIT
To get larger profile images for friends, you need to use the fields
parameter and request a specific type or size of image, e.g.:
/me/taggable_friends?fields=id,name,picture.type(large)
OR
/me/taggable_friends?fields=id,name,picture.width(500)
Using PHP:
$taggable = (new FacebookRequest( $session, 'GET', '/me/taggable_friends', [ 'fields' => 'id,name,picture.type(large)' ] ))->execute()->getGraphObject()->asArray();
echo '<pre>' . print_r( $taggable, 1 ) . '</pre>';
Upvotes: 1
Reputation: 20753
From v2.0 onwards; only the friends using the app that is requesting can be fetched with {user-id}/friends
.
Using the same API with v1.0 was able to fetch all the friends list. But this version will be removed after April 30, 2015. Reference
Upvotes: 0