Check if logged in user has liked my Facebook Page

前端 未结 2 1614
情歌与酒
情歌与酒 2020-12-13 05:20

OK. So I have no idea on how to do this but you are going to have to talk like a 3 year old to me. I know PHP, HTML, CSS and a tiny smidge of javascript. I want to be able t

2条回答
  •  我在风中等你
    2020-12-13 05:54

    Here are the steps to do so:

    1) You need to use this step by step guide to connect user to your facebook page in order to fetch user basic information

    https://developers.facebook.com/docs/facebook-login/getting-started-web/

    FB.api('/me', function(response) {
        console.log('Good to see you, ' + response.name + '.');
    }
    

    2) After knowing that user is connected using facebook you need to issue the graph GET request to find out about this user that he liked your page or not

    FB.api('/me/likes/YOUR_APP_ID', function(response) {
        console.log(response.data);
    }
    

    3) And then run your business logic (whether to take user to download page or other page)

    Code from the tutorial above is given below too

    
    
提交回复
热议问题