简体   繁体   English

Facebook API PHP-发布到实时供稿

[英]Facebook API PHP - post to live feed

I am trying to post to users page feed / wall and instead of my posts stored at the "Posts to page" section as embedded posts. 我正在尝试向用户发布页面供稿/墙,而不是将我的帖子作为嵌入式帖子存储在“帖子到页面”部分。

Here is my code: 这是我的代码:

$request = new FacebookRequest(
            $this->session,
            'POST',
            '/' . $page_id.'/feed',
            array (
                'message' => $msg,
                'link' => $link,
                'id' => $page_id,
                'published' => true
            )
        );
        $response = $request->execute();
        $graphObject = $response->getGraphObject()->asArray();

        return $graphObject;

Please help. 请帮忙。

Instead of a User Token, you need to use a Page Token. 您需要使用页面令牌来代替用户令牌。 Information about all the Tokens and how to get them can be found in the docs: 有关所有令牌以及如何获取它们的信息可以在文档中找到:

This is how it works: 它是这样工作的:

  1. Authorize User with manage_pages and publish_actions 使用manage_pagespublish_actions授权用户
  2. Call /me/accounts to get a list of all your Pages including their Page Tokens 致电/me/accounts以获取所有页面的列表,包括其页面令牌

You can also get an Extended Page Token that is valid forever by using an Extended User token for the call to /me/accounts . 您还可以通过使用扩展用户令牌来调用/me/accounts来获得永久有效的扩展页面令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM