\'130407366991766\',
\'secret\' => \'**
You need to give the Api Key to the constructor. Not the App Id.
I had exactly the same problem. My whole app was broken because getSession() was no longer functioning.
I downloaded the latest version of the PHP SDK and used the example to initialize the user session.
Basically, the session is initialized as soon as you create the Facebook object. So from the example code, when you call.
$facebook = new Facebook(array(
'appId' => '191149314281714',
'secret' => '73b67bf1c825fa47efae70a46c18906b',
));
You already have a session. To get the user ID, you just call:
$uid = $facebook->getUser();
If the result of that call is 0
, then the user is not logged in.
Facebook have changed the way you call the API and the old REST API calls are being depracated. This means that the getSession() method doesn't work anymore.
Facebook Change to OAuth2 and GetSession not working download new base_facebook.php and facebook.php from developers PHP Sdk and replace login procedure to:
if( $userfb = $facebook->getUser() ){
try{
$UserProfile = $facebook->api('/me');
}catch (FacebookApiException $e) {
$userfb = null;
$UserProfile = null;
}
Is work in my site the new version can't show a fb:login-button with perms parameter :( and i can't repair