如果用户是某个页面的粉丝,则获取信息
如果用户是某个页面(fanpage)的粉丝,我在获取信息时遇到问题,因为有时此查询
SELECT uid FROM page_fan WHERE uid=$mUserId AND page_id=$iPageId
会得到一个空结果,尽管用户是该页面的粉丝
我使用了这个 JavaScript 方法,该方法返回了我“resp.error_code” ”和“resp.error_msg”是“无效的 API 密钥”,
FB.api({
method: 'pages.isFan',
page_id: 'FB_FAN_PAGE_ID',
uid: $iUser
}, function (resp) {
if (resp == true) {
alert('fan');
} else if (resp.error_code) {
alert(resp.error_msg);
} else {
alert('no-fan');
}
});
但应用程序启动时代码是正确的,奇怪的是它有时起作用,有时不起作用。 我尝试让用户是粉丝表单请求,就像这篇文章 如何使用 Facebook 的 API 检查用户是否喜欢我的 Facebook 页面或 URL,但它不起作用。 帮助请
I have a problem with getting the information if the user is a fan of a page (fanpage) becouse sometimes this query
SELECT uid FROM page_fan WHERE uid=$mUserId AND page_id=$iPageId
gets me an empty result although the user is a fan of the page
I used this JavaScript method which returned me "resp.error_code" and "resp.error_msg" was "Invalid API key"
FB.api({
method: 'pages.isFan',
page_id: 'FB_FAN_PAGE_ID',
uid: $iUser
}, function (resp) {
if (resp == true) {
alert('fan');
} else if (resp.error_code) {
alert(resp.error_msg);
} else {
alert('no-fan');
}
});
but the code is correct as the application starts and what is strange it sometimes works and sometimes doesn't work.
I try to get the user is fan form request just like in this post How to check if a user likes my Facebook Page or URL using Facebook's API but it doesn't work.
Help pleace
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 JS SDK,您可以检查当前登录的用户是否喜欢某个页面,如下所示:
With JS SDK you can check if the currently logged-in user has liked a page like this: