How do I create an app in Facebook that will force users to like a page in order to use it? [duplicate]
I am trying to replicate the functionality of the page below where there are two tabs (Lady Gaga and Enrique Iglesias) which force users to like a page before they are able to use the app. With the latest Facebook changes is it still possible to be done? I am in the process of building my first app have been googling for the past week and have not gotten开发者_运维问答 anywhere. I am literally pulling my hair :(. I hope somebody can help. Thanks in advance,
http://www.facebook.com/2DayFM
The only way this can be done is by inspecting the signed_request http post parameter in server side code that Facebook sends your site when it loads your page. Here is an example of how to do it in PHP, although its basically the same process in whatever language you know.
It is a violation of Facebook's Platform Policies to incentivize the "Like" action. See https://developers.facebook.com/policy/#integration
You can use an FQL query on the connection table to do this.
select target_id from connection where source_id = 297200003 and target_id = 1024709214
To do an FQL query you can use FB.Data.Query or you can test it on command line using cURL. You need to pass the access_token for the user.
curl "https://api.facebook.com/method/fql.query?format=json&query=selecn+where+source_id=297200003+and+target_id=1024709214&access_token=..."
精彩评论