Reputation: 91
How can I iterate over the IDs of the list of friends of a user of facebook with id say 123 in PHP?
Upvotes: 2
Views: 328
Reputation: 664
Use the api, somthing like:
$result = $facebook->api('/'.$uid.'/friends?fields=name,gender',array('access_token' => $access_token));
to get an array of friends.
Now in order to go over them you need to access the friend data in each item, like this:
foreach($result['data'] as $key => $friend){
//access any data item you want, such as ['id']...
}
I hope this helps...
Upvotes: 2