在网站上显示最新的facebook帖子

时间:2014-06-07 18:41:48

标签: javascript html facebook facebook-opengraph opengraph

由于该网站未托管在Apache服务器上,因此我无法使用PHP在我的网站上显示我的Facebook页面的最新帖子时遇到了问题。

到目前为止我所做的事情:

  • 创建了一个Facebook应用并生成了一个Access令牌。
  • 访问Facebook Developer Graph资源管理器,并使用GET方法

    https://developers.facebook.com/tools/explorer?method=GET&path=nextgenerationmorocco%2Ffeed%3Flimit%3D1&version=v2.0
    

点击Graph Explorer提交按钮后的结果:

 {
  "data": [
    {
      "id": "421944571240838_501444706624157", 
      "from": {
        "category": "Organization", 
        "category_list": [
          {
            "id": "162237190493977", 
            "name": "Computer Training"
          }, 
          {
            "id": "108472109230615", 
            "name": "Computer Services"
          }
        ], 
        "name": "Next Generation I.T.", 
        "id": "421944571240838"
      }, 
      "message": "Inscriptions ouvertes pour la formation symfony2\nProfil du formateur : Ingénieur d'état, 5 ans d'expérience.", 
      "picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCyB9kEztxV2fnb&w=154&h=154&url=http%3A%2F%2Fngitmaroc.com%2Fimg%2Fportfolio%2Fformation-web-1.jpg", 
      "link": "http://ngitmaroc.com/formation-web.html", 
      "name": "Formation Web", 
      "caption": "ngitmaroc.com", 
      "description": "Formation programmation/développement site application web php5 symfony2 Maroc Oujda", 
      "icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif", 
      "privacy": {
        "value": ""
      }, 
      "type": "link", 
      "status_type": "shared_story", 
      "created_time": "2014-06-01T12:17:22+0000", 
      "updated_time": "2014-06-01T12:17:22+0000", 
      "likes": {
        "data": [
          {
            "id": "1459899217586855", 
            "name": "Nassira Said"
          }, 
          {
            "id": "1484688285098548", 
            "name": "Mohamed Tizaoui"
          }, 
          {
            "id": "1458333711077710", 
            "name": "Hasnae Lazaar"
          }, 
          {
            "id": "574623632656391", 
            "name": "KaOûtar OuJdiia"
          }
        ], 
        "paging": {
          "cursors": {
            "after": "NTc0NjIzNjMyNjU2Mzkx", 
            "before": "MTQ1OTg5OTIxNzU4Njg1NQ=="
          }
        }
      }
    }
  ], 
  "paging": {
    "previous": "https://graph.facebook.com/v2.0/421944571240838/feed?limit=1&since=1401625042", 
    "next": "https://graph.facebook.com/v2.0/421944571240838/feed?limit=1&until=1401625041"
  }
}

如何使用Javascript获取这些信息并在我的网站上显示:"message""from""created_time"?任何帮助都将受到高度赞赏,因为我是Javascript和Facebook开发人员的新手!

1 个答案:

答案 0 :(得分:0)

您也可以使用Facebook Likebox插件在您的网站上显示您最近的帖子。