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.

Answers


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

Need Your Help

std::auto_ptr or boost::shared_ptr for pImpl idiom?

c++ boost stl shared-ptr auto-ptr

When using the pImpl idiom is it preferable to use a boost:shared_ptr instead of a std::auto_ptr? I'm sure I once read that the boost version is more exception friendly?

Forcing threads in a service to wait for another thread to finish

c# .net multithreading

I'm writing a service that has five different methods that can take between 5 seconds and 5 minutes to run.