Retrieving Family information from Facebook using FQL?
Hi I am trying to pull information from Facebook using FQL. I was able to gather info on my friends and the profile users likes however I cant seem to get a list of family information, the code I currently have is below. I was wondering if anyone could help and let me know what I am doing wrong, any help would be great appreciated, thanks
<h1>My Family</h1>
<?php
$user = $facebook->getUser();
$friends = $facebook->api('/me/friends');
$fql_query = array(
'method' => 'fql.query',
'query' => "SELECT profile_id, name, relationship F开发者_如何学JAVAROM family WHERE profile_id={$user}");
$family = $facebook->api($fql_query);
$fam = count($family);
echo $fam;
for ($i=0;$i<$fam;$i++){
echo "<p>".$family[$i]['name']." ".$family[$i]['relationship']." from ".$family[$i]['sex']." </p>";
}
?>
You need friends_relationships extended permission to get access to the user's family.
https://developers.facebook.com/docs/reference/api/permissions/
also "sex" you have there seems unrelated
You need user_relationships
permission to view the user's family info.
精彩评论