How to create a fan / like gate on Facebook?

六月ゝ 毕业季﹏ 提交于 2019-12-01 14:24:10

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.

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.

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.

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.

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