我正在使用facebook php sdk 3.2 我正在使用网址“https://graph.facebook.com/user_id/albums?access_token=token来获取用户的所有相册。但对于某些用户来说,它会显示空白结果,例如
{
"data": [
]
}
为什么会发生这种情况,以及如何获取用户的所有相册?
我正在使用的代码是
$this->facebook=new Facebook(array(
'appId' => $appId,
'secret' => $appSecret,
'cookie' => true
));
if(is_null($this->facebook->getUser()) || $this->facebook->getUser()==0)
$this->askForLogin();
$this->accessToken = $this->facebook->getAccessToken();
$feedURL = "https://graph.facebook.com/".$this->facebook->getUser()."/albums?access_token=".$this->accessToken;
$albumData = file_get_contents($feedURL);
答案 0 :(得分:3)
您是否要求获得“user_photos”的许可?
如果用户阻止了照片,则需要在身份验证过程中请求该权限。
您可以在此处详细了解相关权限:http://developers.facebook.com/docs/reference/login/
答案 1 :(得分:0)
这是用户设置的问题,它阻止所有应用查看他的照片。现在解决了这个问题