Search code examples
facebookfacebook-likepointprerequisites

can the facebook LIKE be used as a condition to perform some other action on my website?


My website contains a link to a facebook page, and users who have pressed the LIKE button on that facebook page are allowed to gain some points on my website. I'd like to know if there is an easy way to check if the user trying to earn points on my website has actually pressed the LIKE button on the facebook page, whose link exists on my website. Basically, the condition that an user has pressed the LIKE button on some facebook page is used as a prerequisite for some other action on my website. Thanks for your help


Solution

  • Use this

    $isFan = file_get_contents("https://api.facebook.com/method/pages.isFan?format=json&access_token=" . User_Token . "&page_id=" . FB_Fanpage_ID);
    

    That will return either of following

    • string true string false json
    • formatted response of error if token
    • or page_id are not valid