1

我知道我们可以用这个在朋友的墙上发布一些东西:

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

只需将 $user 变量替换为您朋友的用户 ID。

我希望只是在我的朋友中选择,我想使用复选框来写用户配置文件。

例如,如果您想共享粉丝页面,这已经成为可能。您选择将请求发送给的人。

在此先感谢您的帮助

4

1 回答 1

1

您可以使用 Facebook 的Multi-Friend-Selector (MFS)https://developers.facebook.com/docs/guides/games/custom-muti-friend-selector/

从 Multi-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 时,这是可能的。请参阅我在如何使用 Facebook ID 向朋友发送 Facebook 消息?

于 2012-09-12T03:59:19.123 回答