问题描述
基本上我想知道我的访客是否已经是我的Facebook页面的粉丝.
我试了一会儿,到目前为止, pages.isFan
是最好的解决方案.
http://developers.facebook.com/docs/reference/rest/pages.isFan/
Basically I would like to know if my visitor is already a fan of my Facebook Page or not.
I tried looking a while and pages.isFan
is the best solution so far.
http://developers.facebook.com/docs/reference/rest/pages.isFan/
但是 pages.isFan
需要用户ID( uid
),只有当他们安装或授予对我的Facebook应用的访问权限时,我才能获得该用户ID.
But pages.isFan
need user id (uid
), which I can only get if they installed or grant access to my Facebook apps.
我的问题是,有没有一种方法可以获取访问用户的 uid
,而不要求他们授予对我的Facebook应用程序的访问权限?
My question is, is there a way just to get the uid
of my visiting user without ask them to grant access to my Facebook apps?
推荐答案
此代码应能解决问题:
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["page"]["liked"])) {
/* Not Fan */
}
else {
/* Fan */
}
这篇关于Facebook的pages.isfan需要用户ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!