How to retrieve facebook user's friends albums information with facebook php sdk

╄→гoц情女王★ 提交于 2019-12-13 20:45:33

问题


Im kind of new in facebook development, so be patient with me :) I'm creating an app that manage the photo albums user. One of the features i'm developing needs to access the friends photos. I mean, the photos that my app user can see of his friends. How can retrieve thats albums and photos information? I have user_photos and friends_photos permission. Any sugestion?

Thanks in advance!!

Sorry for my lame english. Is not my native language.

Sebastian


回答1:


You need to make an API call, for this you can use Facebook Graph API. Look at the following API for albums

http://developers.facebook.com/docs/reference/api/album/

This is for generic purpose, however you need to first pull all the friends from here

http://developers.facebook.com/docs/reference/api/FriendList/

To fetch the albums of a friend you also need to set permissions

http://developers.facebook.com/docs/reference/api/permissions/

check:friends_photos

You can simply fetch the album like this

https://graph.facebook.com/{userId}/albums?accessToken=something

PS. you need to pull albums of friends one by one.




回答2:


References to get you started

Start with the Graph API:
developers.facebook.com/docs/reference/api/

Read up on a few more things:
http://developers.facebook.com/docs/opengraph/
http://developers.facebook.com/docs/

Use Graph explorer to test things out:
http://developers.facebook.com/tools/explorer/

Your fist app

Now in order to do anything on facebook you need to create an application. You will get an app token when you do this. Something like: 288229791195831

Your users need to Like your application in order to use it. Then you can use it to post photos, wall messages etc.

This is the URL your application could use to log in a user:

https://graph.facebook.com/oauth/authorize?client_id=288229791195831&redirect_uri=http://www.facebook.com/connect/login_success.html&type=user_agent&display=popup&scope=publish_stream,user_photos,read_stream,email

Replace your client_id with the app id you get from facebook. Scope shows the permissions this app is requesting.

Good luck!



来源:https://stackoverflow.com/questions/9019156/how-to-retrieve-facebook-users-friends-albums-information-with-facebook-php-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!