I am new to Facebook and PHP and so far I managed to connect to Facebook session + permissions, and even to get the logged in user profile picture.
question si : how can I get all of the logged in user photos and pick one randomiz开发者_如何转开发ed one?
thanks
$facebook->api('https://graph.facebook.com/{your_user}/photos?access_token=...');
this is the api for getting photos from the user.
I would use the FQL photo
and album
tables:
SELECT src_big
FROM photo
WHERE aid IN (
SELECT aid
FROM album
WHERE owner=me()
)
And using the PHP-SDK:
$facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT src_big FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner=me())'
));
You can also test the above query in the fql.query
console.
精彩评论