Facebook Wall Feed to Website - Jquery / not PHP



我正在尝试从我的Facebook页面墙中提取活动,包括图像到我的网站。但是,使用标准活动插件 ,显示所有内容(包括我的朋友,但我只想将其限制为我的页面发布)。

有没有办法以Jquery的方式做到这一点?酒吧PHP。

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '385846108120057', // App ID
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML      
    });          
   FB.api(
  {
    method: 'fql.query',
     query: 'SELECT name FROM user WHERE uid=me()'
  });
  function(response) {
    alert('Your name is ' + response[0].name);
  });
 FB.api(
  {
    method: 'fql.query',
     query: 'SELECT post_id, actor_id, target_id, message, attachment 
        FROM stream 
        WHERE source_id = '158904890800614', 
        AND actor_id = '158904890800614'; 
  }); 
  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>
您可以使用

JavaScript SDK 对流表进行 FQL 查询(向下滚动到"API 调用"标头)。这将返回一个JSON对象,您应该能够使用jQuery轻松解析和显示该对象。

下面是帮助您入门的示例查询:

SELECT post_id, actor_id, target_id, message, attachment 
  FROM stream 
  WHERE source_id = 'PAGE_ID' 
    AND actor_id = 'PAGE_ID'

上面 WHERE 语句中的source_id将结果限制为仅页面墙上的帖子,而actor_id将结果限制为页面所做的结果。

最新更新