Facebook PHP SDK Graph API发布到页面无法正常运行

Facebook PHP SDK Graph API发布到页面无法正常运行

问题描述:

我正在尝试为我的应用添加一个功能,该功能会将状态发布到管理员用户的页面时间轴上,具有与Facebook.com上发布的相同的细节。我关注的主要功能是链接共享和缩略图,例如当您将链接粘贴到您的状态,并自动检测缩略图,给您一个很好的链接,描述等。我不知不觉间阅读其他论坛和Graph API文档,我不断遇到问题,显示为管理员用户,而不是页面。这是我的代码:

I'm trying to add a feature to my app that will post a status to a admin user's page timeline with the same detail as if they posted on Facebook.com. The main feature I am focusing on is the link sharing and thumbnail images, like when you paste a link into your status and it auto-detects a thumbnail image, gives you a nice link, description, etc. I have tireless read through other forums and the Graph API documents, and I keep running into problems with the post showing as the admin user, rather than the page. Here is my code:

$facebook = new Facebook(array(
  'appId'  => $appID,
  'secret' => $appSecret,
));

$loginUrl = $facebook->getLoginUrl(array(
    "scope" => 'publish_stream, read_insights, manage_pages, photo_upload, video_upload, create_note, manage_notifications'
));

$access_token   = $facebook->getAccessToken();

$fbpost = array();

$fbpost['access_token'] = $access_token;
$fbpost['message']      = $message;
$fbpost['link']         = $link;
$fbpost['description']  = $description;
$fbpost['caption']      = $caption;
$fbpost['picture']      = $fbimg;

$status = $facebook->api('/'.$pageID.'/feed', 'POST', $fbpost);
var_dump($status);

当我只发布$ fbpost ['message']它正确地将状态发布为页面,但是当我添加任何其他时,它会显示该帖子作为经过身份验证的管理员用户而不是该页面。很沮丧任何想法?

When I only post the $fbpost['message'] it correctly posts the status as the page, but when I add ANYTHING else it shows the post as the authenticated admin user instead of the page. Very frustrating. Any ideas?


我不断遇到问题的帖子显示为管理员用户,而比页面

I keep running into problems with the post showing as the admin user, rather than the page.

然后获取一个页面访问令牌,而不是admin用户的用户访问令牌...

Then get a page access token, not a user access token for the admin user …