Facebook PHP SDK 验证喜欢返回“NOT A FAN”对于一些粉丝

发布于 2025-01-07 02:39:12 字数 921 浏览 1 评论 0原文

我们正在努力解决一个让我发疯的问题。

使用此代码...

$facebook = new Facebook($config);

$uid = $facebook->getUser();

if ($uid) {
  try {
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
    $uid = null;
  }
}

if(!$uid) {
$params = array(
  'scope' => 'email',
  'redirect_uri' => 'https://www.mysite.com/'
);

$loginUrl = $facebook->getLoginUrl($params);

header("Location: $loginUrl");
}

$email = $facebook->api('/me?fields=email');
$email = $email['email'];

$verifyLike = $facebook->api('/me/likes/page_id');
if($verifyLike['data']) {
    echo "FAN"; 
} else {
    echo "NOT A FAN";
}

我们发现大约 8% 的用户看到“不是粉丝”,而他们实际上是我们页面的粉丝。

我一生都无法解决这个问题,而且我已经没有想法了。

任何人都知道导致此问题的原因是什么,更重要的是我们可以采取哪些措施来解决它?

谢谢。

2012 年 2 月 25 日更新 向 Facebook 报告了该错误,他们将错误状态更改为“分类”,并将优先级更改为“低”,但他们尚未找到解决方案,仍在研究中。没有其他人遇到这个问题吗?

We are struggling with a problem that is driving me insane.

Using this code...

$facebook = new Facebook($config);

$uid = $facebook->getUser();

if ($uid) {
  try {
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
    $uid = null;
  }
}

if(!$uid) {
$params = array(
  'scope' => 'email',
  'redirect_uri' => 'https://www.mysite.com/'
);

$loginUrl = $facebook->getLoginUrl($params);

header("Location: $loginUrl");
}

$email = $facebook->api('/me?fields=email');
$email = $email['email'];

$verifyLike = $facebook->api('/me/likes/page_id');
if($verifyLike['data']) {
    echo "FAN"; 
} else {
    echo "NOT A FAN";
}

We are getting about 8% of users who are seeing "NOT A FAN" and they are in fact a Fan of our page.

I can't for the life of me figure out the problem, and I am running out of ideas.

Anyone have any idea what is causing this issue, and more importantly what we can do to fix it?

Thank you.

UPDATE 2/25/12
Reported the bug to Facebook, and they changed the bug status to "Triaged" and the priority to "Low", but they don't yet have a solution and are still looking into it. No one else is experiencing this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

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

评论(1

蓝色星空 2025-01-14 02:39:12

这不是facebook的bug,如果用户的页面设置为低于所有人隐私,则必须向用户请求user_likes扩展权限。

因此,这 8% 的用户在 Facebook 个人资料上拥有更多隐私,并且他们的点赞不会公开。对于所有其他用户,您甚至不需要在 api 请求中提供有效的 access_token。

This is not a bug of facebook, if the user’s pages are set to less than everyone privacy, you must ask the user for the user_likes extended permission.

So these 8% of your users have more privacy on their facebook profiles and their likes are not public. For all other users you don't even need a valid access_token in the api request.

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