How can I get the total number of friends using the Facebook PHP API?
This is my code so far:
<?php require_once 'facebook.php';
$appapikey = 'x';
$appsecret = 'x';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->getuser(); $friends = ???;
Try this
$uid = $facebook->getUser();
$fbme= $facebook->api('/me');
echo "Welcome ".$fbme['name'];
$frnz= $facebook->api('/me/friends');
echo "< br />Total Number of friends you have:".sizeof($frnz['data'])."< br/>";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With