简体   繁体   中英

Get posts on a friend's wall using the Facebook API

I'd like my Facebook app to take the ID of the user using the app, and find posts made by that ID on the wall of one of their friends (I'd prefer an example with an individual ID rather than iterative through all friends).

I figure there's a good possibility that both users will have to provide permissions to the application to do this, and that's fine.

I would prefer posts made directly on another user's wall, as well as any comments made on the target user's status updates / own wall posts.

FQL would be preferable, but I can work with graph. I'm coding in PHP, but I can try to translate from another language if you know the solution in that.

The code I'm currently using is:

SELECT message FROM stream WHERE source_id = <FRIEND ID> AND target_id = <USER ID>

I hardcoded <FRIEND ID> to a test ID (one of the developers), and I have tried with two other <USER ID> s (also developers), all users have read_stream permission given. I'm not sure, but I thought FQL would return an error if there wasn't permission. Either way, it just comes back blank / empty.

you will need at least the "read_stream" and the "publish_stream" of users.

Then you can select via fql. See http://developers.facebook.com/docs/reference/fql/stream/

and http://developers.facebook.com/docs/authentication/permissions/ for a list of permissions you can request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM