使用Facebook API在状态发布数组中引用特定用户对象的语法是什么?以下是我的内容。
$status = $facebook->api('/<PAGE_ID>/feed', 'POST', array(
'from' => "id": "<PAGE_ID>", "name": "<PAGE_NAME>",
'title' => 'This is the title',
'message' => 'This is the message',
'description'=> 'This is the description',
'caption' => 'This is the caption',
'link' => 'http://www.thisisthelink.com'
));
除FROM字段外,一切正常。
答案 0 :(得分:0)
/<PAGE_ID>/feed
不接受from
参数,只有http://developers.facebook.com/docs/reference/api/page/#posts中的参数可供指定。
答案 1 :(得分:0)
这很有效。我把帖子的参数和feed的参数混淆了。
<?
require_once 'fb_access.php';
$user = $facebook->getUser();
if ($user) {
try {
$page_id = '****NOT*PHP*CODE*PLACEHOLDER*FOR*PAGE*ID*DUH****';
$page_info = $facebook->api("/$page_id?fields=access_token");
if( !empty($page_info['access_token']) ) {
$args = array(
'access_token' => $page_info['access_token'],
'message' => 'This is the message',
'link' => 'http://thisisthelink',
'caption' => 'This is the caption',
'description' => 'This is the description',
);
$post_id = $facebook->api("/$page_id/feed","post",$args);
}
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
?>