使用FB.ui发布到页面墙

发布于 2024-10-11 01:48:49 字数 512 浏览 5 评论 0原文

我正在使用 FB.ui 发布到 Facebook 用户墙。但是,我不确定使用哪些参数来发布到页面或应用程序墙。有链接吗?

我正在尝试以页面的形式发布到页面墙,而不是以用户的帐户的形式。

发布到用户帐户的代码:

 FB.ui(
   {
     method: 'feed',
     name: name,
     link: link,
     picture: picture,
     caption: caption,
     description: redemption,
     message: message
   },
   function (response) {
     if (response && response.post_id) {
       alert(response.post_id);
     } else {

     }
   }
 );

I'm using FB.ui to post to a Facebook user wall. However, I am uncertain on which parameters to use to post to a Page or Application wall. Any links?

I am trying to post to the Page wall as that page, not as the user's account.

Code to post to user account:

 FB.ui(
   {
     method: 'feed',
     name: name,
     link: link,
     picture: picture,
     caption: caption,
     description: redemption,
     message: message
   },
   function (response) {
     if (response && response.post_id) {
       alert(response.post_id);
     } else {

     }
   }
 );

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

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

发布评论

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

评论(6

花辞树 2024-10-18 01:48:49

明白了:

您必须设置 tofrom 值:

FB.ui(    {
  method: 'feed',
  name: name,
  link: link,
  picture: picture,
  caption: caption,
  description: redemption,
  message: message,
  to: page_id,
  from: page_id    
 },    
function (response) {
    if (response && response.post_id) {
      alert(response.post_id);
    } else {

    }    
   }  
);

Got it:

you have to set the to and from values:

FB.ui(    {
  method: 'feed',
  name: name,
  link: link,
  picture: picture,
  caption: caption,
  description: redemption,
  message: message,
  to: page_id,
  from: page_id    
 },    
function (response) {
    if (response && response.post_id) {
      alert(response.post_id);
    } else {

    }    
   }  
);
逆夏时光 2024-10-18 01:48:49

我使用 JavaScript SDK 在用户墙上发布:

function graphStreamPublish(){
           var body = document.getElementById("txtTextToPublish").value;
            FB.api('/me/feed', 'post', { message: body }, function(response) {
                if (!response || response.error) {
                     alert('Error occured');
                } else {
                     alert('Post ID: ' + response.id);
                }
           });
     }

当我浏览 Graph API 页面< /a> 我认为如果您将 '/me/feed/' 更改为 'pageId/feed' 那么它可能会在该页面中发布消息。我不知道。 - 只是一个建议。

I used the JavaScript SDK to post on user's wall:

function graphStreamPublish(){
           var body = document.getElementById("txtTextToPublish").value;
            FB.api('/me/feed', 'post', { message: body }, function(response) {
                if (!response || response.error) {
                     alert('Error occured');
                } else {
                     alert('Post ID: ' + response.id);
                }
           });
     }

When I go through the Graph API Page I think if you change '/me/feed/' to 'pageId/feed' then it may post the message in that page. I am not sure. - just a suggestion.

蓝眼睛不忧郁 2024-10-18 01:48:49

截至 2012 年 2 月,在朋友的墙上分享:

FB.ui({
    method: 'stream.publish',
    app_id: appId,
    display: 'iframe',
    name: name,
    link: link,
    picture: picture,
    caption: caption,
    description: description,
    target_id: friendIds
});

To share on a friend's wall, as of February 2012:

FB.ui({
    method: 'stream.publish',
    app_id: appId,
    display: 'iframe',
    name: name,
    link: link,
    picture: picture,
    caption: caption,
    description: description,
    target_id: friendIds
});
十六岁半 2024-10-18 01:48:49

要发布到 Facebook 墙,请使用以下命令...

使用简单的调用来调用下面的 js 函数,如下所示

<a href="#" onclick="publishWallPost()">Post to Wall image/text?</a> 


//facebook: post to wall 
function publishWallPost() {

      FB.ui({
          method: 'feed',
          name: 'Your App Name',
          caption: 'Caption Text',
          description: 'Your description text',
          link: 'https://www.facebook.com/link/link.link',
          picture: fbImg
        },
        function (response) {
          console.log('publishStory response: ', response);
        });
      return false;
}


window.fbAsyncInit = function () {
      FB.init({
        appId: 'Your App ID',
        status: true,
        cookie: true,
        xfbml: true
      });
};

(function () {
      var e = document.createElement('script');
      e.async = true;
      e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
      document.getElementById('fb-root').appendChild(e);
}());

To post to facebook wall use the following.. .

Call the below js function using simple call as in below

<a href="#" onclick="publishWallPost()">Post to Wall image/text?</a> 


//facebook: post to wall 
function publishWallPost() {

      FB.ui({
          method: 'feed',
          name: 'Your App Name',
          caption: 'Caption Text',
          description: 'Your description text',
          link: 'https://www.facebook.com/link/link.link',
          picture: fbImg
        },
        function (response) {
          console.log('publishStory response: ', response);
        });
      return false;
}


window.fbAsyncInit = function () {
      FB.init({
        appId: 'Your App ID',
        status: true,
        cookie: true,
        xfbml: true
      });
};

(function () {
      var e = document.createElement('script');
      e.async = true;
      e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
      document.getElementById('fb-root').appendChild(e);
}());
余生一个溪 2024-10-18 01:48:49

抱歉,这是一个老问题,但我认为这可能对通过谷歌找到它的人有帮助。
http://fbmhell.com/2011/07/facebook-分享-popup-iframe-tabs-jquery/

Sorry, this is an old question, but I thought this might be helpful for people who find it via google.
http://fbmhell.com/2011/07/facebook-share-popup-iframe-tabs-jquery/

糖粟与秋泊 2024-10-18 01:48:49

只需记住 target_id 需要解析为 int 即可。响应[“to”]作为字符串返回。

Just remember target_id needs to be parsed into an int. The response["to"] comes back as a string.

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