如何构建 Facebook 的“点赞按钮”喜欢主页消息吗?

发布于 2024-11-09 17:14:37 字数 275 浏览 4 评论 0原文

例如:

  • 我有一个关于我的网站的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

源来凯始玺欢你 2024-11-16 17:14:37

只需使用帖子的永久链接作为 fb:like 按钮中的 url 即可。棘手的部分是弄清楚永久链接是什么,因为如果它是链接、状态或视频,它会采用不同的形式。对于链接或状态更新,格式如下:

http://www.facebook.com/<PAGE_USERNAME>/posts/<POST_ID> 

或者,如果您没有用户名:

http://www.facebook.com/permalink.php?story_fbid=<POST_ID>&id=<PAGE_ID>

您可以通过访问 http://graph.facebook.com/来确定帖子 ID 和页面 ID。 /posts 并在 _ 上拆分 id 字符串。

Simply use the permalink of the post as your url in an fb: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:

http://www.facebook.com/<PAGE_USERNAME>/posts/<POST_ID> 

Or, if you don't have a username:

http://www.facebook.com/permalink.php?story_fbid=<POST_ID>&id=<PAGE_ID>

You can determine the post ID and page ID by accessing http://graph.facebook.com/<PAGE_ID>/posts and splitting the id string on the _.

末骤雨初歇 2024-11-16 17:14:37

您应该能够POST到任何支持点赞的对象的/likes URL。不应指定任何参数。您可以通过对同一 URL 执行 DELETE 请求来删除点赞。

/OBJECT_ID/喜欢
就像给定的对象一样
(如果有 /likes 连接)

因此您应该 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 a DELETE request to the same URL.

/OBJECT_ID/likes
Like the given object
(if it has a /likes connection)

So the URL you should POST to, is https://graph.facebook.com/[pageId]/likes

Read more under Publishing on this page: http://developers.facebook.com/docs/reference/api/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文