简单的 Facebook API

发布于 2024-12-19 07:35:12 字数 349 浏览 3 评论 0原文

假设我的粉丝页面上有一个简单的登陆页面,其中包含 3 个“帖子”,其中包含标题、一些文字和一个视频。

我希望每个帖子都有一个分享和喜欢按钮,这样用户就可以喜欢和分享独特的帖子。

点赞按钮必须有一个计数器。

谁能回答我的问题或给我一个教程的链接吗?

谢谢!

编辑:感谢您的回答,但可以说:我的一个朋友去了我的粉丝页面和登陆页面“欢迎”。他会看到这个:i41.tinypic.com/157zmh.jpg,并决定喜欢其中一个“帖子”。当他点击“喜欢”时,它将显示在他的墙上,并带有标题、一些文字等。一张照片。该链接会转到粉丝页面上的登陆页面。其中一个“帖子”将知道有 1 个赞,同时其他两个仍然有 0 个赞。

Lets say I have simple landingpage on my fan page with 3 "post" with a headline, some text and a video.

I want to get a share and a like button for every of the posts, so the users can like and share the unique post.

The like button must have a counter on.

Could nayone answer my question or give me a link to a tutorial?

Thanks!

EDIT: Thanks for the answer, but lets say: One of my friends go to my fan page and the landingpage "Welcome". He will see this: i41.tinypic.com/157zmh.jpg, and decides to like one of the "posts". When He clicks like, it will be shown on his wall with the headline, some text and ect. a picture. The link goes to the landingpage on the fan page. One of the "post" will know have 1 like, meanwhile the other two will still have zero.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

少女情怀诗 2024-12-26 07:35:12

听起来您正在寻找 Facebook 社交插件。它们是最容易实施的“Facebook 元素”。

如果它们不能满足您的要求,您可以查看 Javascript SDK,可能是第二容易的。

作为编辑的更新:

“赞”按钮的工作原理如下:它会在您的页面上显示有关您刚刚喜欢的内容的信息,如果您想控制其行为,可以添加 打开图表标签 来执行此操作。

在您的示例中,您有一个页面,上面有三个不同的视频,为了区分开放图标签,您可以使用不同的查询字符串值。

这是一些糟糕的伪代码示例,试图解释我的意思:

//Pseudo server side code

variable video = get_query_string_value("video");

switch (video) {
    case "wolf-shirt":
        add wolf shirt open graph tags;
        break;
    case "unicorns"
        add unicorn video open graph tags;
        break;
} 

然后你的“喜欢”按钮看起来像这样:

<div class="fb-like" data-href="www.example.com/mypage.php?video=wolf-shirt" data-send="true" data-width="450" data-show-faces="true"></div>

<div class="fb-like" data-href="www.example.com/mypage.php?video=unicorns" data-send="true" data-width="450" data-show-faces="true"></div>

如果有人在狼衬衫视频,当 Facebook 的抓取工具查找数据时,您将向 Facebook 展示狼衬衫开放图标签。

It sounds like you are looking for the Facebook Social Plugins. They are the easiest "Facebook elements" to implement.

If they don't satisfy your requirements you can take a look at the Javascript SDK, probably second easiest.

As an update to your edit:

The like button works like this: It scapes your page for information about what you just liked, if you want to control it's behaviour you can add open graph tags to do so.

In your sample you have one page with three different videos on it, in order to differ the open graph tags you make the like go on different query string values.

Here is some lousy pseudo code sample that tries to explain what I mean:

//Pseudo server side code

variable video = get_query_string_value("video");

switch (video) {
    case "wolf-shirt":
        add wolf shirt open graph tags;
        break;
    case "unicorns"
        add unicorn video open graph tags;
        break;
} 

Then your like buttons would look something like:

<div class="fb-like" data-href="www.example.com/mypage.php?video=wolf-shirt" data-send="true" data-width="450" data-show-faces="true"></div>

<div class="fb-like" data-href="www.example.com/mypage.php?video=unicorns" data-send="true" data-width="450" data-show-faces="true"></div>

It will result in if someone clicks the like button at the wolf shirt video, you will present the wolf shirt open graph tags to Facebook when its scraper look for data.

孤檠 2024-12-26 07:35:12

这应该可以解决问题!祝你好运! 链接

This should do the trick! Good luck! link

や莫失莫忘 2024-12-26 07:35:12

不能使用 Facebook Like 插件来喜欢Facebook 帖子。您必须使用图形 API。但这意味着每个朋友都应该允许您的应用程序。

您必须向(具有 publish_stream 权限)发出 POST HTTP 请求:

POST_ID/likes

更多信息请参阅 文档

You cannot use the Facebook Like plugin to like a Facebook post. You'll have to use the Graph API. But this would mean that every friend should allow your app.

You have to issue a POST HTTP request to (with publish_stream permission):

POST_ID/likes

More info is available in the documentation.

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