我要开发一个FBML内部应用程序。我用过:
require 'facebook.php';$appId ='xxx';$secret ='xyx';$facebook = new Facebook(array( 'appId' => $appId, 'secret' => $secret, 'cookie' => true,)); $session = $facebook->getSession();
但是我无法获取登录用户的个人资料数据..用户名,姓名等......
哪里弄错了?
答案 0 :(得分:1)
您需要响应用户登录尝试并检索cookie ...
//attach this below your current code
FB.Event.subscribe('auth.login', function(response) {
window.location.reload();
});
然后还
//somewhere before you load the page...
$cookie = get_facebook_cookie(FACEBOOK_APP_ID, FACEBOOK_SECRET);
检查http://developers.facebook.com/docs/authentication/并查看使用Javascript SDK的单点登录