I have a problem with this piece of code, I search everywhere but didn't get answer for this problem. It's my code
<?php
require_once('facebook.php');
$facebook = new Facebook(array(
'appId' => 'XXXXXXXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXX',
));
$user_id = $facebook->getUser();
echo $user_id;
?>
This code everytime returns 0 even when I'm logged in on facebook with my account, can someone help me to fix this problem or explain what's wrong? I'm using facebook-php-sdk-v3.1.1-21
I want to make something like this, in registration form want to add facebook like button, when user click on this button he become fan of my facebook fan page, if he don't hit like button script must check for this and output error, that before user can register must hit like button, can someone give me some tips or piece of script how to realize this with PHP?