I know, that my question was asked a lot of times here, but for me no answer worked. I ve created a Facebook Fanpage Tab. All the files are stored at my private Webspace. Now I want to determine if a user already liked the page or haven t liked it yet!
So I used this code:
<?php
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) {
$isteinfan = "false";
}
else {
$isteinfan = "true";
}
}
//PHP Variable an JavaScript übergeben
echo "<script>";
echo "isteinfan = $isteinfan ;";
echo "console.log( ist ein fan: );";
echo "console.log(isteinfan);";
echo "</script>";
?>
But it doesn t work. Can u give me help, please!!! Yours, Raphael