如何一次获取所有Facebook朋友的ID? [英] How to get all Facebook friend`s Id at once?

查看:224
本文介绍了如何一次获取所有Facebook朋友的ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前,当我打开graph.facebook.com时,我可以在一个地方获得我所有朋友的ID,但是现在我将重定向到另一个开发者页面.

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.

我想知道是否还有任何方法可以立即获取朋友的ID.我知道graph.facebook.com/username功能,但是我想一次拥有所有功能.

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.

推荐答案

以下是使用 facebook-php-sdk ,它将从您的应用程序中返回所有朋友的ID号:

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'];
}

这篇关于如何一次获取所有Facebook朋友的ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆