How to get friend list in array on facebook fan page tab application?

Last two night I was struggling in finding the solution of  my question “How to get friend list in array on facebook fan page tab application?

Finally find the solution last night..Just follow the following

Enable a ajax call on first click on facebook fanpage application at the tab then in the post page of ajax
run this code combination of PHP and FQL

<?php
include 'facebook.php';
$facebook = new Facebook('APIKEY','APPSECRET');
$user=$_REQUEST['fb_sig_user'];
$query_page="SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = $user)";
$result_frnd = $facebook->api_client->fql_query($query_page);
if($result_frnd)
{
$i=0;
foreach ($result_frnd as $frnd)
{
$allFriend[$i]=$frnd['uid'];
$i++;
}
}

?>

All the friend’s user id will be stored in $allFriend[] array…
Enjoy

Leave a Reply

Your email address will not be published. Required fields are marked *