使用 FQL 从 Facebook 检索家庭信息?

发布于 2024-12-07 00:07:27 字数 827 浏览 0 评论 0原文

您好,我正在尝试使用 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技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我的鱼塘能养鲲 2024-12-14 00:07:27

您需要 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

攒一口袋星星 2024-12-14 00:07:27

您需要 user_relationships 权限才能查看用户的家庭信息。

You need user_relationships permission to view the user's family info.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文