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 empty 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:
- friend_photos permissions