I have the following code:
$facebook = new Facebook(array(
'appId' => '###',
'secret' => '###'
));
$user = $facebook->getUser();
$user is ALWAYS 0, my AppId and Secret are both 100% correct. What am I doing wrong?
make sure that you have an if condition to check for user status
$user=$facebook->getUser();
if($user)
//someactions
else
{
// redirect the user to login and authorize your application, if necessary
header('Location:'.$facebook->getLoginURL());
}
Please check the case of functions. I may be wrong.
Just chek in your facebook Your FB Application Admin Panel if you put the right website url... LOCALHOST for testing purpose or your http://www.YOURWEBSITE.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With