2

Earlier when I open graph.facebook.com, I can get the ID's of all the friends of mine at one place but now I am getting redirect to another developer page.

enter image description here

I want to know whether any method still left by which I can get the friend's ID at once. I know that graph.facebook.com/username feature, but I want to have all at once.

serenesat
  • 4,611
  • 10
  • 37
  • 53
Akansh
  • 1,715
  • 3
  • 15
  • 34

3 Answers3

2

Here is an example using the facebook-php-sdk that will return the id number for all your friends from within your application:

include_once('facebook-php-sdk/src/facebook.php');

$facebook = new Facebook(array(
  'appId'  => '<your_app_id>',
  'secret' => '<your_app_secret>',
));
$result = $facebook->api("/me/friends?limit=0");
$friends = array();
foreach ($result['data'] as $index => $friend) {
   $friends[] = $friend['id'];
}
Cyclonecode
  • 29,115
  • 11
  • 72
  • 93
0

The path graph.facebook.com/[user id]?fields=friends.fields(id) will get what you want. You just have to make sure to send the appropriate credentials.

I recommend you use Facebook's Graph Explorer tool. It is handy to select what you want.

http://developers.facebook.com/tools/explorer/?method=GET&path=511552816%3Ffields%3Did%2Cname

Amal Murali
  • 75,622
  • 18
  • 128
  • 150
Nick Mitchinson
  • 5,452
  • 1
  • 25
  • 31
0

The path graph.facebook.com/[ tools/explorer/]?fields=friends.fields(511552816%3Ffields%3Did%2C) will get what you want. You just have to make sure to send the appropriate credentials.

I recommend you use Facebook's Graph Explorer tool. It is handy to select what you want.

http://developers.facebook.com/tools/explorer/?method=GET&path=511552816%3Ffields%3Did%2Cname

ko sint
  • 1
  • 3