Here is a small php examples to get all the friends with php and facebook API
FQL Query to get all friends
SELECT uid, name, pic_square FROM user WHERE uid = me()
OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
Using GRAPH API
https://graph.facebook.com/me/friends?access_token=YOUR_ACCESS_TOKEN
this will return all your friends list.After getting the friends list you can use folowing script to loop through the returened Array
foreach ($friends as $key=>$value) {
echo count($value) . ' Friends';
echo '<hr />';
echo '<ul id="friends">';
foreach ($value as $fkey=>$fvalue) {
echo '<li><img src="https://graph.facebook.com/' . $fvalue[id] . '/picture" title="' . $fvalue[name] . '"/></li>';
}
echo '</ul>';
}
Labels: facebook API and PHP
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment