如何构建 Facebook 的“点赞按钮”喜欢主页消息吗?
例如:
我有一个关于我的网站的 Facebook 页面。
在我的网站上,我显示我最近的 3 条 Facebook 页面消息 (graph.facebook.com/[pageId]/[更多参数])
- 在每个 Facebook 页面消息(如它们出现在我的网站上)旁边,我想添加一个 FaceBook Like 按钮。单击“赞”按钮时,应该向 Facebook 页面消息提供“赞”。如何做到这一点?
For example:
I have a FaceBook Page about my website.
On my website, I display my 3 most recent FaceBook page messages (graph.facebook.com/[pageId]/[more parameters])
- Next to each FaceBook Page message (as they appear on my website) I would like to add a FaceBook Like button. When the like button is clicked, a "Like" should be given to the FaceBook Page Message. How can this be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需使用帖子的永久链接作为
fb:like
按钮中的url
即可。棘手的部分是弄清楚永久链接是什么,因为如果它是链接、状态或视频,它会采用不同的形式。对于链接或状态更新,格式如下:或者,如果您没有用户名:
您可以通过访问
http://graph.facebook.com/来确定帖子 ID 和页面 ID。 /posts
并在_
上拆分id
字符串。Simply use the permalink of the post as your
url
in anfb:like
button. The tricky part will be figuring out what the permalink is, since it takes different forms if it's a link, status, or video. For a link or status update, it's this format:Or, if you don't have a username:
You can determine the post ID and page ID by accessing
http://graph.facebook.com/<PAGE_ID>/posts
and splitting theid
string on the_
.您应该能够
POST
到任何支持点赞的对象的/likes
URL。不应指定任何参数。您可以通过对同一 URL 执行DELETE
请求来删除点赞。因此您应该
POST
到的 URL 是https://graph.facebook.com/[pageId]/likes
阅读更多内容在此页面上发布: http://developers.facebook.com/docs/reference/api/< /a>
You should be able to
POST
to the/likes
URL of any object that supports likes. No arguments should be specified. You can remove a like by executing aDELETE
request to the same URL.So the URL you should
POST
to, ishttps://graph.facebook.com/[pageId]/likes
Read more under Publishing on this page: http://developers.facebook.com/docs/reference/api/