I use this to get user photos, but always print_ran empty array:
$facebook = new Facebook(array(
'appId' => 'XXX',
'secret' => 'XXX',
'cookie' => true,
));
if ($facebook->getSession()) {
try {
$profile = $facebook->api('/me/photos');
echo "<pre>";
print_r($profile);
} catch (FacebookApiException $e) {
echo $e->getMessage();
exit();
}
}
else {
$login_url = $facebook->getLoginUrl(array(
'next' => 'XXX',
'cancel_url' => 'XXX',
'req_perms' => 'user_about_me,user_location,user_hometown,user_birthday,user_interests,user_likes,user_photos'
));
echo '<a href="'.$login_url.'">Click here to login</a>';
}
If I use:
$profile = $facebook->api('/me');
It is an print_rarray full of data, but not the photo information I'm looking for.
Any ideas?
source
share