How to retrieve facebook user’s friendlist


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Using graph api:
  2. function getUserFriendList($facebook){
  3. $friends = $facebook->api('/me/friends');
  4. return $friends;
  5. }
  6.  
  7.  
  8.  
  9. Using legacy api:
  10. function getUserFriendList($facebook, $uid){
  11. try {
  12. $param = array(
  13. 'method' => 'friends.get',
  14. 'uid' => $uid,
  15. 'flid' => '',
  16. 'callback'=> ''
  17. );
  18. $friends = $facebook->api($param);
  19. return $friends;
  20. }
  21. catch(Exception $o) {
  22. d($o);
  23. }
  24. return '';
  25. }

URL: http://thinkdiff.net/facebook/how-to-retrieve-facebook-users-friendlist/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.