I what to develop a FBML internal applica开发者_Go百科tion. I used:
require 'facebook.php';$appId ='xxx';$secret ='xyx';$facebook = new Facebook(array( 'appId' => $appId, 'secret' => $secret, 'cookie' => true,)); $session = $facebook->getSession();
But I can not get the profile data of the user logged in..uid,name, etc...
Where I get it wrong?
You need to respond to the user login attempt and also retrieve the cookie...
//attach this below your current code
FB.Event.subscribe('auth.login', function(response) {
window.location.reload();
});
And then also
//somewhere before you load the page...
$cookie = get_facebook_cookie(FACEBOOK_APP_ID, FACEBOOK_SECRET);
Check http://developers.facebook.com/docs/authentication/ and look at Single Sign On with Javascript SDK
精彩评论