0
我想发布状态消息给多个FB用户,但不是他们在我的网站上。我为每个发布的用户发布了publish_stream perms和60天访问令牌,但我无法弄清楚如何正确批量发布。批量墙贴到多个Facebook帐户使用PHP
这是放入访问令牌的正确方法吗?
$body = array(
'message' => $message,
'link' => $link,
'picture' => $picture,
'name' => $name,
'description'=> $description
);
$batchPost=array();
$i=1;
foreach ($user_fb_id_array as $fb_id) {
$batchPost[] = array(
'method' => 'POST',
'relative_url' => "/" . $fb_id['user_fb_id'] . "/feed?access_token=" . $fb_id['user_fb_auth_code'], // Will this work???
'body' => http_build_query($body));
if($i++ == 50) {
try {
$multiPostResponse = $this->facebook->api('?batch='.urlencode(json_encode($batchPost)), 'POST');
} catch(FacebookApiException $e) {
error_log($e);
echo("Batch Post Failed");
}
unset($batchPost);
$i=1;
}
}
if(isset($batchPost) && count($batchPost) > 0) {
try{
$multiPostResponse = $this->facebook->api('?batch='.urlencode(json_encode($batchPost)), 'POST');
} catch(FacebookApiException $e){
error_log($e);
echo("Batch Post Failed");
}
}
要在信用到期时给予抵免,此代码已从25labs.com原始代码修改。
这是我从文档的理解,是的 – Igy 2012-07-25 09:19:45