简体   繁体   English

我应该怎么获得的Facebook用户的好友列表,并在PHP他们的个人资料图片的使用图形API?

[英]How should i get Facebook user friend list and their profile picture's using Graph API in PHP?

I am using this code to get the user friend's list. 我正在使用此代码来获取用户朋友的列表。 For profile picture i am unable to find any reference please guide if you know the process 对于个人资料图片,我找不到任何参考,如果您知道此过程,请进行指导

$facebook = new Facebook($config);

$user_id = $facebook->getUser();
$iLimit=99;
if($user_id) {

     // We have a user ID, so probably a logged in user.
     // If not, we'll get an exception, which we handle below.

     try {

       $user_profile = $facebook->api('/me','GET');
      echo"<h3>";

echo 'Name: ' . $user_profile['name'];
echo"</h3>";
$profile_pic =  "http://graph.facebook.com/".$user_id."/picture";

echo "<img src=\"" . $profile_pic . "\" />"; 
$user_friends = $facebook->api('/me/friends', 'GET' );
print_r($user_friends);            //Given NULL Value 
echo "</pre>";\

Returning null value 返回空值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM