【问题标题】:How to post to Facebook page as page itself如何作为页面本身发布到 Facebook 页面
【发布时间】:2012-09-03 07:14:35
【问题描述】:

我正在开发一个博客模块。当管理员添加新博客帖子时,将在页面的 facebook 墙上发布新帖子(我们称之为Mypage)。它的代码是:

$_accessKey = FB_ACCESS_KEY;
$_feedId = FB_FEED_ID;

$attachment =  array(
                    'access_token'  => $_accessKey,
                    'message'       =>  $postData['message'],
                    'name'          => $postData['name'],
                    'description'   => $postData['caption']
            );

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/'.$_feedId.'/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);
$result = curl_exec($ch);
curl_close ($ch); 

在上面的代码中:

FB_ACCESS_KEY是来自用户Test的应用程序的访问令牌@
FB_FEED_ID是页面的提要ID。

现在Mypage 的发帖工作正常,但帖子将以Added by Test 的身份发送。
我怎样才能让帖子就像是Mypage 自己发的一样?
TestMypage 页面的管理员。

【问题讨论】:

    标签: facebook curl facebook-php-sdk


    【解决方案1】:

    作为主页进行身份验证应该可以为您解决问题:https://developers.facebook.com/docs/authentication/pages/

    【讨论】:

    • 谢谢。我没有注意到那个文档页面。做到了。 :)
    猜你喜欢
    • 1970-01-01
    • 2013-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-29
    • 1970-01-01
    相关资源
    最近更新 更多