使用 FQL 从 Facebook 检索家庭信息?
您好,我正在尝试使用 FQL 从 Facebook 提取信息。我能够收集有关我的朋友和用户喜欢的个人资料的信息,但我似乎无法获取家庭信息列表,我当前拥有的代码如下。我想知道是否有人可以帮助并让我知道我做错了什么,任何帮助将不胜感激,谢谢
<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 FROM 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>";
}
?>
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 FROM 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>";
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要 Friends_relationships 扩展权限才能访问用户的家人。
https://developers.facebook.com/docs/reference/api/permissions/
还有你在那里的“性”似乎无关
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
您需要
user_relationships
权限才能查看用户的家庭信息。You need
user_relationships
permission to view the user's family info.