Skip to content

Instantly share code, notes, and snippets.

@ericnkatz
Last active September 27, 2015 11:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericnkatz/1262096 to your computer and use it in GitHub Desktop.
Save ericnkatz/1262096 to your computer and use it in GitHub Desktop.
Check if person "Likes" the facebook page.
<?php
/*
* Check to see if a person likes the current facebook page.
*/
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["page"]["liked"])) {
echo "You are not a fan!";
} else {
echo "Welcome back fan!";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment