How to create a fan / like gate on Facebook?

后端 未结 4 953
抹茶落季
抹茶落季 2021-01-17 01:14

I am trying to create a simple fan/like gate. Where you specify one content for none fans and other content for fans (if they pressed the like button). However when I run th

相关标签:
4条回答
  • 2021-01-17 01:39

    It looks like the original poster switched to using Wildfire's like gate app. But anyway...

    Your server is doing a redirect before your script is run. If you put your code in a folder such as http://apps.talkiesmagazine.eu/facebook/home/index.php - but you specify http://apps.talkiesmagazine.eu/facebook/home as your url - the webserver will see that http://apps.talkiesmagazine.eu/facebook/home is a folder and redirect to http://apps.talkiesmagazine.eu/facebook/home/. That redirect doesn't preserve the POST data which carries the signed request. You can see if you put http://apps.talkiesmagazine.eu/facebook/home in your browser, it is redirected to http://apps.talkiesmagazine.eu/facebook/home/.

    Changing your tab url to http://apps.talkiesmagazine.eu/facebook/home/ will fix it.

    However, Facebook requires that you have your server setup for securely serving your app over https and set the secure tab url to that url. You have the Secure Page Tab URL empty, so that would need to be changed as well to have a fully functional tab.

    0 讨论(0)
  • 2021-01-17 01:47

    Not sure why the signed request isn't showing for you. It's still working.

    code: http://fbmhell.com/2011/06/facebook-like-gating-in-iframe-tabs/

    page tab: http://www.facebook.com/snipe.net?sk=app_207328155971716

    Maybe it's something in the migration settings that you have to check/uncheck? They've made some changes over the past few months.

    0 讨论(0)
  • 2021-01-17 01:53

    Let's try this:

    1, Create a simple php file on the app root named index.php with the following code:

    <?
    
    echo "POST check<br /><pre>";
    print_r ($_POST);
    echo "</pre>";
    
    ?>
    

    2, Go to your app tab, and check what is come up.

    2a, If the "POST check" message only, check the app URL on the app settings page. May be forget to close the url with / or there is a space somewhere.

    2b, If the "POST check" message followed by an array structure, something wrong with your SDK implementation.

    0 讨论(0)
  • 2021-01-17 01:59

    Your example is using the Facebook PHP SDK by the looks of it. If you want something a bit simpler and relatively straight forward to implement, then take a look at this Facebook Fan / Like Gate over on GitHub.

    I've used it on a bunch of Facebook tabs in the past and it's served me well. There's also a 'JavaScript setup' branch with the js sdk and application config setup and ready to go.

    0 讨论(0)
提交回复
热议问题