$app_id = "apid";
$app_secret = "appsecret";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$signed_request = $facebook->getSignedRequest();
$like_status = $signed_request["page"]["liked"];
// If a fan is on your page
if ($like_status) {
$a = file_get_contents("https://mysite/likepage");
echo ($a);
} else {
// If a non-fan is on your page
$a = file_get_contents("https://mysite.com/reveal");
echo ($a);
}
I hope that helps, even if it's not what you were looking to hear.The liked field will no longer be returned in the page property of the signed_request object for Page Tab apps created from today onwards. For apps created before today, from November 5, 2014 (90 days from today), the liked property will always return true regardless of whether or not the person has liked the page.
Join our newsletter to get alerts for Joomla releases, tips and tricks and extension updates.