1
我有一组Facebook用户,已经使用自定义的Facebook多选择器输出。以Facebook用户阵列 - 张贴给朋友墙
输出是所选用户的列表。
如何获取这些身份证号码,然后使用Facebook API将消息发布到他们的墙上?
我有一组Facebook用户,已经使用自定义的Facebook多选择器输出。以Facebook用户阵列 - 张贴给朋友墙
输出是所选用户的列表。
如何获取这些身份证号码,然后使用Facebook API将消息发布到他们的墙上?
下面是一个简单的PHP代码片段我使用之前
$attachment = array(
'from' => $_SESSION['username'],
'access_token' => $access_token,
'message' => $message,
'name' => $title,
'link' => $url,
'description' => $description,
'caption' => $caption,
'picture' => $img,
'privacy' => json_encode(array('value' => 'FRIENDS_OF_FRIENDS'))
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/'.$userid.'/feed');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //to suppress the curl output
$result = curl_exec($ch);
curl_close ($ch);
确保你有一个有效的访问令牌这是你的应用程序给定。
请求用户的“publish_stream”权限。
编辑:
这里是发布到用户的墙
function fb_publish() {
FB.ui(
{
method: 'stream.publish',
message: 'Message here.',
attachment: {
name: 'Name here',
caption: 'Caption here.',
description: (
'description here'
),
href: 'url here'
},
action_links: [
{ text: 'Code', href: 'action url here' }
],
user_prompt_message: 'Personal message here'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
}
感谢的JavaScript的方式 - 但没有人有一个JavaScript SDK例子呢? – 2012-02-01 15:40:21
感谢您的Javascript编辑。但是我确实知道如何做到这一点,但我只关心如何获取一些ID号码,然后将它们推送到上面的JavaScript代码。 – 2012-02-02 13:09:08
让java识别ID数组的中间位置就是我挣扎的地方! – 2012-02-02 13:09:37