2012-09-11 37 views
1

发布到朋友的墙,我知道我们可以发布一个朋友的东西墙与此:使用Facebook的API

$publishStream = $facebook->api("/$user/feed", 'post', array(
    'message' => "Your Message", 
    'link' => 'http://example.com', 
    'picture' => '', 
    'name' => 'App Name', 
    'description'=> 'App description' 
)); 

只需用你的朋友的用户ID替换$用户变量。

我希望仅仅是在我的朋友之间进行选择,我想使用复选框编写用户配置文件。

这是已经可以的,如果你想分享粉丝页面的例子。你选择你发送请求的人。

在此先感谢您的帮助

+1

写入新闻馈送*集体*可能会被视为垃圾邮件。考虑使用请求系统,而不是: https://developers.facebook.com/docs/reference/dialogs/requests/ –

+0

在消息写在墙上之前是否可以发送通知? – Slrg

+2

这是,但这是解决问题,而不是面对它。 Feed并不打算以这种方式使用。如果您希望用户能够向多个用户发送消息,请使用Requests系统,而不是Feed。 –

回答

2

您可以使用Facebook的多朋友选择器(MFS)https://developers.facebook.com/docs/guides/games/custom-muti-friend-selector/

从多朋友,选择文档

function renderMFS() { 
// First get the list of friends for this user with the Graph API 
FB.api('/me/friends', function(response) { 
    var container = document.getElementById('mfs'); 
    var mfsForm = document.createElement('form'); 
    mfsForm.id = 'mfsForm'; 

    // Iterate through the array of friends object and create a checkbox for each one. 
    for(var i = 0; i < Math.min(response.data.length, 10); i++) { 
    var friendItem = document.createElement('div'); 
    friendItem.id = 'friend_' + response.data[i].id; 
    friendItem.innerHTML = '<input type="checkbox" name="friends" value="' 
     + response.data[i].id 
     + '" />' + response.data[i].name; 
     mfsForm.appendChild(friendItem); 
    } 
    container.appendChild(mfsForm); 

    // Extract selected friends' Facebook ID from value property of checked checkboxes 

    // Do a for loop to send notification (refer to the link posted below) and publish post to each user's wall 
    }); 
} 

,并有可能采取的一个编辑的例子的消息写在墙壁上之前 发送通知?

是的,这是可能的,当你有Facebook的ID。请参阅我的回答How to send Facebook message to friend using Facebook ID?