Предполагая, что вы создали экземпляр класса facebook (здесь, "$ Fb"),
и учитывая ваш идентификатор и секрет ...
«$ user» - это facebook «user_id» (т. е. 12345678 ...) пользователя, которому мы хотим получить список друзей
$access_token = $Fb->getAccessToken();
$user_profile = $Fb->api('/me');
// show user image
$txt .= "<p align=\"center\">
<img src=\"https://graph.facebook.com/".$user."/picture\"></p>";
$FBid = $user_profile['id'];
$FBnick = $user_profile['username'];
$txt .= fb_friends_list($user_profile,$access_token);
echo ($txt);
// вышеупомянутый вызывает следующую функцию, чтобы получить список друзей:
function fb_friends_list($fbup,$access_token)
{
// display the friends list on 3 columns, with their avatar.
global $Sess,$Fb;
$friends = $Fb->api('/me/friends'); // return an array [data][0 to n][name]/[id]
$siz = sizeof($friends['data']);
$txt = "<h3 align=\"center\">Your FRIENDS on FACEBOOK</h3>";
$txt .= "<table align=\"center\">
<tr>
<td class=\"blu s12 bld\">Friend's<br />Avatar</td>
<td class=\"blu s12 bld\">Friend's Name</td>
<td width=\"30px\"> </td>
<td class=\"blu s12 bld\">Friend's<br />Avatar</td>
<td class=\"blu s12 bld\">Friend's Name</td>
<td width=\"30px\"> </td>
<td class=\"blu s12 bld\">Friend's<br />Avatar</td>
<td class=\"blu s12 bld\">Friend's Name</td>
</tr>";
$col = 0;
for ($i=0; $i<$siz; $i++)
{
$fid = $friends['data'][$i]['id'];
$src = "http://graph.facebook.com/".$fid."/picture";
if ($col == 0)
$txt .= "<tr>";
$txt .= "<td><img src=\"".$src."\" /></td>";
$txt .= "<td>".$friends['data'][$i]['name'] . "</td>";
$txt .= "<input type=\"hidden\" name=\"".$fid."\" />";
$col++;
if ($col < 3)
$txt .= "<td width=\"30px\"> </td>";
if ($col == 3)
{
$col = 0;
$txt .= "</tr>";
}
}
if ($col != 0)
$txt .= "</tr>";
$txt .= "</table>";
return($txt);
}
Надеюсь, это сработает для вас!