Cannot get a session with Facebook app? (using its Graph API)
- by Jian Lin
I have really simple few lines of Facebook app, using the new Facebook API:
<pre>
<?php
require 'facebook.php';
// Create our Application instance.
$facebook = new Facebook(array(
'appId' => '117676584930569',
'secret' => '**********', // hidden here on the post...
'cookie' => true,
));
var_dump($facebook);
?>
but it is giving me the following output:
http://apps.facebook.com/woolaladev/i2.php would give out
object(Facebook)#1 (6) {
["appId:protected"]=>
string(15) "117676584930569"
["apiSecret:protected"]=>
string(32) "**********" <--- just hidden on this post
["session:protected"]=>
NULL <--- Session is NULL for some reason
["sessionLoaded:protected"]=>
bool(false)
["cookieSupport:protected"]=>
bool(true)
["baseDomain:protected"]=>
string(0) ""
}
Session is NULL for some reason, but I am logged in and can access my home and profile and run other apps on Facebook (to see that I am logged on).
I am following the sample on:
http://github.com/facebook/php-sdk/blob/master/examples/example.php
http://github.com/facebook/php-sdk/blob/master/src/facebook.php
(download using raw URL: wget http://github.com/facebook/php-sdk/raw/master/src/facebook.php )
Trying on both hosting companies at dreamhost.com and netfirms.com, and the results are the same.