开发者

Using PHP-SDK to get the album details

开发者 https://www.devze.com 2023-04-05 12:23 出处:网络
I\'m tried get the details of an album using the PHP-SDK and facebook class, using the following code:

I'm tried get the details of an album using the PHP-SDK and facebook class, using the following code:

$data = $facebook->api('me/albums');

the code above return an empty array.

But if I try get the friends:

$friends = $facebook->api('/me/friends');

works fine. Why? the permissions are same.

开发者_运维知识库

in 'pure' mode:

$url = "https://graph.facebook.com/me/albums/?access_token={$_SESSION['access_token']}";
$res = curl($url);
$json = json_decode($res);

too works fine.


to get the alubms details of the currently logged-in user, you need to request for the "user_photos" permission too.


You have to have "user_photos" permission to access this resource. Make sure the access_token you are using takes care of that.

0

精彩评论

暂无评论...
验证码 换一张
取 消