如何在 facebook 页面中发布提要?我已经在我的墙帖中完成了,但我不知道如何使用 javascript api 在页面中进行墙帖。其实我想要喜欢
我从 facebook api 找到了代码。请帮忙。
如何在 facebook 页面中发布提要?我已经在我的墙帖中完成了,但我不知道如何使用 javascript api 在页面中进行墙帖。其实我想要喜欢
我从 facebook api 找到了代码。请帮忙。
试试这个:
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p>
<a href="javascript:;" onclick='postToFeed(); return false;'>Post to Group</a>
</p>
<p id='msg'></p>
<script>
FB.init({appId: "Yourappid", status: true, cookie: true});
function postToFeed() {
// calling the API ...
FB.api('/Pageid/feed', 'post',
{
// for the newer versions of the Facebook API you need to add the access token
access_token: 'page access token'
message : "It's awesome ...",
link : 'Link',
picture : 'Imageurl',
name : 'Featured of the Day',
to: 'Pageid',
from: 'Pageid',
description : 'Your description'
},
function(response) {
if (!response || response.error) {
alert(JSON.stringify(response.error));
} else {
alert('Post ID: ' + response.id);
}
});
}
</script>
</body>
放入您的 HTML 正文标记中。
https://developers.facebook.com/docs/reference/api/page/
使用以下文本搜索提要标题:
您可以通过向 PAGE_ID/feed 连接发出 HTTP POST 请求来创建链接、帖子或状态消息
要在发布到墙上时模拟页面(即作为页面而不是当前用户发布),您必须使用具有 manage_pages 和 publish_stream 权限的页面 access_token,如上面的页面访问令牌中所述。