简体   繁体   English

使用 Facebook API 在朋友的墙上发帖

[英]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).我希望我的 Facebook 应用程序获取使用该应用程序的用户的 ID,并在他们的一个朋友的墙上找到由该 ID 发布的帖子(我更喜欢具有个人 ID 的示例,而不是遍历所有朋友)。

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. FQL 会更好,但我可以使用图形。 I'm coding in PHP, but I can try to translate from another language if you know the solution in that.我正在使用 PHP 进行编码,但如果您知道其中的解决方案,我可以尝试从另一种语言翻译。

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.我将<FRIEND ID>硬编码为一个测试 ID(开发人员之一),并且我尝试了另外两个<USER ID> (也是开发人员),所有用户都具有 read_stream 权限。 I'm not sure, but I thought FQL would return an error if there wasn't permission.我不确定,但我认为如果没有权限,FQL 会返回错误。 Either way, it just comes back blank / empty.无论哪种方式,它都会返回空白/空。

you will need at least the "read_stream" and the "publish_stream" of users.您至少需要用户的“read_stream”和“publish_stream”。

Then you can select via fql.然后你可以通过fql select。 See http://developers.facebook.com/docs/reference/fql/stream/请参阅http://developers.facebook.com/docs/reference/fql/stream/

and http://developers.facebook.com/docs/authentication/permissions/ for a list of permissions you can request.http://developers.facebook.com/docs/authentication/permissions/获取您可以请求的权限列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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