I have a Facebook fan page and I want to check if the user visiting the page LIKES the page in order to show the content. It works when I am logged in as the administrator but when another account visits the page the facebook->getUser()
always return 0
require 'src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'ID',
'secret' => 'HASH',
'cookie' => true,
));
$user = $facebook->getUser();
//Page id
$page = '215010578537112';
$likeID = $facebook->api(array( 'method' => 'fql.query', 'query' =>
'SELECT uid FROM page_fan WHERE uid =' . $user . 'AND page_id =' .$page ));
if ( $likeID ) {
}else{
}