How to implement the Facebook application "How to use"?

Many Facebook applications will ask you to β€œlike” before using. How to implement it? Is there a special API for this?

+4
source share
2 answers

FBML pages are outdated, and now you can only create iframe frame pages. When a user navigates to your page, Facebook sends the signed_request parameter, which you need to decode. This article has a step-by-step guide on how to do this.

function parsePageSignedRequest() { if (isset($_REQUEST['signed_request'])) { $encoded_sig = null; $payload = null; list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2); $sig = base64_decode(strtr($encoded_sig, '-_', '+/')); $data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true)); return $data; } return false; } if($signed_request = parsePageSignedRequest()) { if($signed_request->page->liked) { echo "This content is for Fans only!"; } else { echo "Please click on the Like button to view this tab!"; } } 
+5
source

If your application is an iframe loaded on the Page tab, you can use signed_request. http://developers.facebook.com/docs/authentication/signed_request/

+1
source

All Articles