Pulling in photos via Facebook Graph API
I'm trying to pull in tagged photos of the current logged in profile. Got a session ID but it appears it's an empt开发者_高级运维y array.
<?php
$photos = $facebook->api('me/photos');
$number_of_photos = count($photos[data]);
?>
<?php for ($i=0; $i < $number_of_photos; $i++) :?>
<img src="https://graph.facebook.com/me/photos/<?php echo $photos[data][$i][url]; ?>"/>
<?php endfor; ?>
I'm aware this code is probably really awful, I'm new to PHP and just trying a few things.
As stated by the documentation available here (scroll down to 'Connections'), in order to get user's photos she must have explicitly given you one of the following permissions:
- user_photo_video_tags
- friend_photo_video_tags
- user_photos
- friend_photos permissions
精彩评论