This is driving me crazy >=(
$facebook->getUser() works well sometimes, but sometimes returns 0
Here is my code:
require 'fbapi/facebook.php';
$facebook = new Facebook(array(
'appId' => 'xxx',
'secret' => 'xxxxx',
));
$user = $facebook->getUser();
the appId and secret are the correct ones.
Which could be the reason that getUser sometimes it returns 0???
It's more than likely something on Facebook's end (devs have gone through this before a while back). If $user
returns null or 0, simply reroute them to the login url (which you should have). The liklihood of it returning 0 again is minimal (unless there's a bug on their end or there's more to your code than what you've posted).