Facebook Check if user “Liked” the page

◇◆丶佛笑我妖孽 提交于 2019-11-26 23:32:55

问题


I made a few Facebook FBML Canvas pages (Facebook considers these to be Applications) for a company, and they requested that users who "Like" the page would be redirected to another page, or the page will display different content with AJAX.

I went through the Facebook Developers Documentation, but I can't find a clue on how to do it.

I'm sure someone has done it before, any suggestions?


回答1:


I found this on the Facebook forum I think it might help you out!

How can i redirect when someone like/share?

I haven't tried it myself though!

Good luck!




回答2:


You can use either the JS or PHP sdk to check if a user liked a page. See examples below...

Uses JS sdk to check if a user liked a page (can be any page, just set the page id). This can be used in a standalone app or from within a page tab. - http://unbound-media.com/facebook/how-to-tell-if-a-facebook-user-likes-your-facebook-application/

Uses PHP sdk to check if a user liked the page from a tabbed app (can only check if user liked the current page they're on). This method can also be converted to JS. - How to check if a user likes my Facebook Page or URL using Facebook's API




回答3:


If you are dealing with facebook app tab page, the following code helps you to find isfan status

$signed = parse_signed_request($_REQUEST['signed_request'], 'YOUR-APP-SECRET');
if ($signed['page']['liked'] == 1) {
    $fan = true;
} else {
    $fan = false;
}

Visit this link for demo and source code.



来源:https://stackoverflow.com/questions/4750012/facebook-check-if-user-liked-the-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!