开发者

How can I get all my photos from Facebook with PHP SDK?

开发者 https://www.devze.com 2023-02-16 07:02 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消