如何将 Facebook 页面的 feed 嵌入到我的网站中

发布于 2025-01-03 16:22:46 字数 342 浏览 5 评论 0原文

我正在与一个团体合作,帮助推广一项慈善活动。我想要嵌入的页面不是我的 Facebook 个人资料,而是某人创建的 Facebook 页面。

我想在我的网页中显示该新闻源。如果我需要从此页面获取信息/访问权限,请告诉我。如果其他人有有效的示例,请告诉我。我一直在使用 jsfiddle.net 来绘制它。

这是页面:http://www.facebook.com/pages /厨师-经典-淘汰赛/225835004169328

I am working with a group to help promote a charity event. The page I would like to embed is NOT my Facebook profile, but a Facebook page someone has created.

I would like to show that news feed in my webpage. If I need to get info/access from this page, please let me know. If someone else has a working example, please let me know. I have been using jsfiddle.net to draw it up.

Here's the page: http://www.facebook.com/pages/Chefs-Classic-Knock-OUT-Bout/225835004169328

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

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

发布评论

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

评论(7

夕色琉璃 2025-01-10 16:22:46

啊哈,这非常简单,不需要编程。

请参阅:https://developers.facebook.com/docs/plugins/page-plugin

您需要保持显示流选项处于打开状态。您可以调整宽度和高度以及其他一些内容。

Ahhh, that's super simple, no programming required.

See: https://developers.facebook.com/docs/plugins/page-plugin

You'll want to keep the show stream option turned on. You can adjust width and heigth and a few other things.

泪之魂 2025-01-10 16:22:46

如果您正在寻找自定义代码而不是插件,那么这可能会对您有所帮助。 Facebook 图表自发展以来经历了一些变化。这些步骤适用于我最近尝试过并且运行良好的最新 Graph API。

涉及三个主要步骤 - 1. 确保您可以使用服务器端语言 (PHP) 进行编码,2. 获取 Facebook 访问令牌,3. 调用 Graph API 并传递访问令牌。

1.获取访问令牌 - 以下是获取 Facebook 页面的访问令牌的分步过程。 - 在我的网站上嵌入 Facebook 页面 feed。为此,您需要在 Facebook 开发者页面中创建一个应用程序,该应用程序将为您提供应用程序 ID 和应用程序密钥。使用这两个并获取访问令牌。

2.调用 Graph API - 一旦获得访问令牌,这将非常简单。您只需使用要检索的所有字段/属性形成 Graph API 的 URL,并向该 URL 发出 GET 请求。下面是一个关于如何在 ASP.NET MVC 中执行此操作的示例。 使用 asp.net mvc 嵌入 facebook feed。这在任何其他技术中都应该非常相似,因为它只是一个 HTTP GET 请求。

示例 FQL 查询: https://graph.facebook.com/FBPageName/posts?fields=full_picture,picture,link,message,created_time&limit=5&access_token=YOUR_ACCESS_TOKEN_HERE

If you are looking for a custom code instead of plugin, then this might help you. Facebook graph has under gone some changes since it has evolved. These steps are for the latest Graph API which I tried recently and worked well.

There are three main steps involved - 1. Make sure you can code with a server side language (PHP), 2. Getting Facebook Access Token, 3. Calling the Graph API passing the access token.

1. Getting the access token - Here is the step by step process to get the access token for your Facebook page. - Embed Facebook page feed on my website. As per this you need to create an app in Facebook developers page which would give you an App Id and an App Secret. Use these two and get the Access Token.

2. Calling the Graph API - This would be pretty simple once you get the access token. You just need to form a URL to Graph API with all the fields/properties you want to retrieve and make a GET request to this URL. Here is one example on how to do it in asp.net MVC. Embedding facebook feeds using asp.net mvc. This should be pretty similar in any other technology as it would be just a HTTP GET request.

Sample FQL Query: https://graph.facebook.com/FBPageName/posts?fields=full_picture,picture,link,message,created_time&limit=5&access_token=YOUR_ACCESS_TOKEN_HERE

辞别 2025-01-10 16:22:46

在新的 page-plugin 中,您可以在网站中执行多个选项卡操作。页面插件可让您轻松在您的网站上嵌入和推广任何 Facebook 页面。就像在 Facebook 上一样,您的访问者无需离开您的网站即可点赞和分享页面。

  1. 在您的页面上包含一次 JavaScript SDK,最好是在开始 标记之后。
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId={APP_ID}";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

  1. 将插件的代码放置在您希望插件出现在页面上的任何位置。
<div class="fb-page" 
     data-href="https://www.facebook.com/YourPageName" 
     data-tabs="timeline" 
     data-small-header="false" 
     data-adapt-container-width="true" 
     data-hide-cover="false" 
     data-show-facepile="true">
  <div class="fb-xfbml-parse-ignore">
    <blockquote cite="https://www.facebook.com/facebook">
      <a href="https://www.facebook.com/facebook">Facebook</a>
    </blockquote>
  </div>
</div>

您还可以更改以下设置:

在此处输入图像描述

此外,您现在还可以使用新页面插件创建时间线、事件和消息选项卡:

  • 时间线选项卡:将显示 Facebook 页面时间线的最新帖子。
  • 事件选项卡:人们可以关注您的页面事件并从插件订阅事件。
  • 消息选项卡:人们可以直接从您的网站向您的页面发送消息。人们需要登录才能使用此功能。
<div class="fb-page" 
  data-tabs="timeline,events,messages"
  data-href="https://www.facebook.com/YourPageName"
  data-width="380" 
  data-hide-cover="false">
</div>

In new page-plugin you can do multiple tabs in your website. The Page plugin lets you easily embed and promote any Facebook Page on your website. Just like on Facebook, your visitors can like and share the Page without leaving your site.

  1. Include the JavaScript SDK on your page once, ideally right after the opening <body> tag.

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId={APP_ID}";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

  1. Place the code for your plugin wherever you want the plugin to appear on your page.

<div class="fb-page" 
     data-href="https://www.facebook.com/YourPageName" 
     data-tabs="timeline" 
     data-small-header="false" 
     data-adapt-container-width="true" 
     data-hide-cover="false" 
     data-show-facepile="true">
  <div class="fb-xfbml-parse-ignore">
    <blockquote cite="https://www.facebook.com/facebook">
      <a href="https://www.facebook.com/facebook">Facebook</a>
    </blockquote>
  </div>
</div>

You can also change the following settings:

enter image description here

Also You can now have timeline, events and messages tabs with the new page plugin:

  • Timeline Tab: Will show the most recent posts of your Facebook Page timeline.
  • Events Tab: People can follow your page events and subscribe to events from the plugin.
  • Messages Tab: People can message your page directly from your website. People need to be logged in to use this feature.

<div class="fb-page" 
  data-tabs="timeline,events,messages"
  data-href="https://www.facebook.com/YourPageName"
  data-width="380" 
  data-hide-cover="false">
</div>

梦初启 2025-01-10 16:22:46

Like Box/ Page 插件基本上是一个 iframe 并且丑陋:D

所以我创建了自己的免费插件,我称之为 Famax 插件 显示 FanPage 提要。它与点赞框类似,但具有更好的用户界面并且更可定制。

另外,由于 Like 框显示在具有固定宽度和高度等的 iframe 中,因此它的响应速度并不快。

The Like Box/ Page plugin is basically an iframe and ugly :D

So I created my own free plugin that I call Famax plugin to display FanPage feeds. It's similar to the like box but has a better UI and is more customizable.

Also because the Like box is shown in an iframe with a fixed width and height etc, its not really responsive.

挽手叙旧 2025-01-10 16:22:46

如果我错了,请纠正我,但 Facebook 似乎已弃用 Activity Feed 插件。此外,似乎不再有任何替代活动的插件。

这是链接:https://developers.facebook.com/docs/plugins/activity

Correct me if I am wrong, but it seems that Facebook deprecated the Activity Feed plugin. Additionally there does not seem to be any substitute plugin for activity anymore.

Here is the link: https://developers.facebook.com/docs/plugins/activity

野の 2025-01-10 16:22:46

对于网站开发人员,您的另一个选择是遵循有效的 Facebook Graph API 教程,例如 这个

但是,如果您需要一个可以立即自定义和嵌入 Facebook 页面提要的快速解决方案,则应该使用网站插件,例如 这个

以下是分步指南:

  1. 获取免费密钥付费密钥
  2. 前往此登录页面并使用密钥登录。
  3. 登录后,单击“+ 创建自定义源”按钮。
  4. 在弹出窗口中,为您的自定义 Facebook 页面提要命名。
  5. 在下拉列表中,选择“您网站上的 Facebook 页面源”选项。
  6. 输入您的 Facebook 主页 ID。
  7. 单击“继续”按钮。这将向您显示自定义选项。
  8. 单击屏幕右上角的“嵌入网站”按钮。
  9. 在弹出窗口中,单击“复制代码”按钮复制嵌入代码。
  10. 将嵌入代码粘贴到您的网站上。

访问教程链接查看那里也有现场演示。

For website developers, another option you have is to follow a working Facebook Graph API tutorial such as this one.

But if you need a quick solution where you can customize and embed a Facebook page feed instantly, you should use website plugins such as this one.

Here's a step by step guide:

  1. Get a Free Key or Paid Key.
  2. Go to this login page and use the key to login.
  3. Once logged in, click “+ Create Custom Feed” button.
  4. On the pop up, name your custom Facebook page feed.
  5. On the drop-down, select “Facebook Page Feed On Your Website” option.
  6. Enter your Facebook Page ID.
  7. Click the “Proceed” button. This will show you the customization options.
  8. Click the “ Embed On Website” button located on the upper-right corner of the screen.
  9. On the pop up, copy the embed code by clicking the “Copy Code” button.
  10. Paste the embed code on your website.

Visit the tutorial link to see a live demo there as well.

逐鹿 2025-01-10 16:22:46

将插件的代码放置在您希望插件出现在页面上的任何位置。

<iframe 
  src="https://www.facebook.com/v18.0/plugins/page.php?href=https://www.facebook.com/facebook&show_posts=true"
  frameborder="0"
  allowtransparency="true"
  allowfullscreen="true"
  scrolling="no"
  allow="encrypted-media"
  width="500px"
  height="500px"
  style="border:none;visibility:visible">
</iframe>

将此链接 https://www.facebook.com/facebook 替换为您的页面链接

Place the code for your plugin wherever you want the plugin to appear on your page.

<iframe 
  src="https://www.facebook.com/v18.0/plugins/page.php?href=https://www.facebook.com/facebook&show_posts=true"
  frameborder="0"
  allowtransparency="true"
  allowfullscreen="true"
  scrolling="no"
  allow="encrypted-media"
  width="500px"
  height="500px"
  style="border:none;visibility:visible">
</iframe>

Replace this link https://www.facebook.com/facebook with your page link

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