【问题标题】:SDK php , add news in Public wallSDK php,在公共墙添加新闻
【发布时间】:2013-12-04 22:22:21
【问题描述】:

我尝试在我的墙上发布新闻(面向所有人),但我的程序无法运行,您能帮帮我吗?

            $app_config = array(
                'appId' => 'xxxxxxxxxxxxxxxx',
                'secret' => 'xxxxxxxxxxxxxxx',
                'cookie' => true
            );
            $page_config = array(
                'access_token' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
                'page_id' => 'xxxxxxxxxxxxxxxxxxxxx'
            );


            $facebook = new Facebook($app_config);


            $privacy=array('value' => 'EVERYONE');
            $decri=array('name' => 'See the link', 'link' => 'http://www.xxxxxx.com');
            $description="this is a test";
            $picture="a.png";

            $params = array(
             'access_token' => $page_config['access_token'],
             'name' => $title,
             'caption' => 'www.xxxxxx.com',
             'link' => 'http://www.xxxxxx.com',
             'description' => $description,
             'picture' => $picture,
             'status_type' => 'mobile_status_update',
             'type' => 'status',
             'privacy' => json_encode($privacy),
             'actions' => json_encode($decri)
            );

            $post_id = $facebook->api('/'.$page_config['page_id'].'/feed','post',$params);

但是什么都没有发布,我不明白 非常感谢你

【问题讨论】:

    标签: facebook-graph-api facebook-php-sdk facebook-page


    【解决方案1】:

    根据您的代码,我假设您正在发布到 Facebook 页面 - 在这种情况下,尤其是链接。

    当您尝试发布链接时,不要将它们发布到/PAGE_ID/feed,而是将它们发布到/PAGE_ID/links(请参阅Facebook Documentation)。

    在您的示例中,您的 API 请求应如下所示:

    $post_id = $facebook->api('/'.$page_config['page_id'].'/links','post',$params);
    

    另外,$picture 应该是一个链接,以httphttps 开头。

    最后但同样重要的是,请确保您拥有publish_streammanage_pages 权限。

    与文档相比,您使用的参数略有不同,因此请仔细检查documentation - 似乎您做的工作太多。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      • 2015-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多