检测用户喜欢的Facebook应用程序 [英] Detecting if user like facebook app
问题描述
我正在尝试几个小时,以检查当前用户是否喜欢我的应用程序。
我需要登录的user_likes权限,但即使我点击相似的按钮,当我检查用户喜欢的应用程序与isFan或FQL我还是得到零喜欢!
I'm trying for hours now to check if the current user is "liked" my app. I do require "user_likes" permission on login but even when I'm clicking the like button, when I check if the user like the app with isFan or with FQL I still get zero likes!
这是我试图得到如果用户喜欢的应用程序:
this is how I'm trying to get if the user "liked" the app:
$isFan = $facebook->api(array(
"method" => "pages.isFan",
"page_id" => xxxxx,
"uid" => $session
));
if($isFan === TRUE)
echo "I'm a fan!";
或
$likes = $facebook->api(array(
'method' => 'fql.query',
'query' => "SELECT uid FROM page_fan WHERE page_id='xxxxx' AND uid='$session'",
));
print 'likes found: ' . count($likes) . '<br />';
两种方法都给我什么,如果有人可以帮助我,这将是非常好的!
both methods gives me nothing, please if some one can help me it will be great!
谢谢!
Moti
Thanks! Moti
推荐答案
您要使用页面ID而不是应用程序ID。我不知道您的页面是否是Facebook页面(facebook.com/pages/ [PAGE_NAME] / [PAGE_ID] ),或者如果您有非Facebook页面。
You want to use the Page ID instead of the App ID. I'm not sure if your page is a Facebook Page (facebook.com/pages/ [PAGE_NAME] / [PAGE_ID] ) or if you have a non-Facebook page.
显然,如果您有一个Facebook页面,则该网址末尾的号码将是您的页面ID。否则,如果您有非Facebook页面,您可以使用图表获取您的页面ID。
Obviously if you have a Facebook page then the number on the end of the URL will be your Page ID. Otherwise if you have a non-Facebook page you can use the graph to get your Page ID.
https://graph.facebook.com/?id= [PAGE_URL]
使用该ID而不是应用程序ID,它应该提供正确的结果。请确保使用 Facebook文档
Use that ID instead of the app ID and it should give you the correct result. To be sure try it out with the tool on the Facebook docs
这篇关于检测用户喜欢的Facebook应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!