Facebook Graph Api - 以管理员身份发布到粉丝页面

问题描述:

我设置了一个脚本,允许用户在 Facebook 的粉丝页面上发布消息.一切正常,但有一个小问题.

I've setup a script which allows users to post messages to a fan page on Facebook. It all works but there's one small issue.

问题:

当帖子被添加到页面提要时,它会显示发帖用户的个人帐户.我希望它显示页面的帐户(例如,当您是该页面的管理员时,它说它来自该页面).我发布的帐户拥有该页面的管理员权限,但它仍显示为个人帖子.

When the post is added to the page feed it displays the posting user's personal account. I would prefer it to show the account of the page (like when you're admin of the page it says it came from that page). The account I'm posting with have admin rights to the page, but it still shows as a personal post.

HTTP POST

$url = "https://graph.facebook.com/PAGE_ID/feed";
$fields = array (
    'message' => urlencode('Hello World'),
    'access_token' => urlencode($access_token)
);

$fields_string = "";
foreach ($fields as $key => $value):
    $fields_string .= $key . '=' . $value . '&';
endforeach;
rtrim($fields_string, '&');

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);

$result = curl_exec($ch);
curl_close($ch);

据我所知,你所要做的就是在你的调用中指定一个 uid(即页面的 ID)stream.publish

As far as I know, all you have to do is specify a uid (that is, the page's ID) in your call to stream.publish

看看模仿