Make a Like gate for Facebook
A litte code for detect user who have liked or not your page. Working on your facebook tab.
function parse_signed_request($signed_request)
{
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$sig = base64_url_decode($encoded_sig);
return json_decode(base64_url_decode($payload), true);
}
function base64_url_decode($input) {
return base64_decode(strtr($input, '-_', '+/'));
}
$datas = parse_signed_request($_REQUEST['signed_request']);
if($datas['page']['liked']) {
// content for likers
} else {
// like gate
}
Written by R.Kueny
Related protips
2 Responses
Interesting, would this be better to do in javascript?
over 1 year ago
·
@mdeiters Why do you want to do this in javascript ?
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Facebook
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#