我有以下代码从facebook
获取用户数据<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'the_app_code_here_but_i_didn't right_it_here',
status : true,
cookie : true,
xfbml : true
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<div class="fb-login-button">Login with Facebook</div>
这是使用facebook.php类
提取数据的PHP代码$user_data = $this->facebook->getUser();
if(!empty($user_data))
{
$uid = $this->facebook->getUser();
$user = $this->facebook->api('/me');
if(!empty($user)) {
print_r($user_data);
die();
}
else
{
die("error");
}
}
else
{
die("error else");
}
我得到“错误”,当我检查firebug时,我有以下错误“未捕获的异常:错误:https://www.facebook.com权限被拒绝获取属性Proxy.InstallTrigger “
我用Google搜索并且没有运气的想法..因为我使用的是firefox 8,它是否与firefox有关?
答案 0 :(得分:3)
最新的PHP + Javascript SDK示例可在此处找到:https://developers.facebook.com/blog/post/534/ - Facebook的后端需要在您的应用上启用oauth2.0,并且可能更容易复制+粘贴正在运行的应用,然后根据您的要求调整它。