0

Facebook ページのウォールから、画像を含むアクティビティを自分の Web サイトに取り込もうとしています。ただし、標準の Activity Plugin を使用すると、すべてが表示されます (友達を含むが、自分のページの投稿に限定したいだけです)。

これを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>
4

1 に答える 1

0

JavaScript SDK を使用して、ストリーム テーブルへの FQL クエリ(「API 呼び出し」ヘッダーまでスクロールダウン) を作成できます。これにより、jQuery を使用して簡単に解析および表示できる JSON オブジェクトが返されます。

開始するためのサンプル クエリを次に示します。

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

上記source_idの WHERE ステートメントの は、結果をページのウォールへの投稿のみにactor_id制限し、 は結果をページによって作成されたもののみに制限します。

于 2012-06-03T15:19:30.630 に答える