ds3422222 2013-11-14 12:24
浏览 6

如何在页面的墙上发布app或page(非用户)

Yes there's almost a hundred same question as this. i have tried the answers provided and searched on forums etc...but all didn't work for me :( . I a have an app on facebook. I want to post a link to my page's timeline. (NOT ON USER'S TIMELINE). how can i do this using php sdk? i found this post How do you post to the wall on a facebook page (not profile). it's very informative yet i still dont know excatly what to do. i also rea this post Post to Facebook Page Wall. still no help for me. this is what i have at the moment:

     require_once('libs/facebook.php');
    $facebook = new Facebook(array(
        'appId' => 'xxxxxxxxxxxxxxxxxx',
        'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    ));

    $attachment = array(
        'link' => $post_link,
        'message' => 'Another Super Story!',
        'actions' => array(
            array(
                'link' => $post_link
            )
        )
    );

    $result = $facebook->api('/me/feed/', 'post', $attachment);

i saw this code but i dont know what the number stands for

$facebook->api('/123456789/feed', 'post', array( 'access_token' => $token, 'link' => 'http://www.example.com' ));

please help me. im desperate to solve my problem. i dont know what to do. thank you in advance.

EDIT: i now have this code as i have refered to this question Facebook API: How to post to my own wall page? . but still, not working for me. anyone who could tell what i'm missing?

    $page_access_token = "2xxxxxxxxxxxx|bxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
                $result = $facebook->api("/me/accounts");
                foreach($result["data"] as $page) {
                    if($page["id"] == $page_id) {
                        //$page_access_token = $page["access_token"];
                        $page_access_token = $facebook->api("/".FB_PAGE_ID."?fields=access_token");
                        break;
                    }
                }
    $attachment = array(
    'message' => $post_msg,
    'link' => $post_link,
    'access_token' => $page_access_token,
    );
    $facebook->api("/".FB_PAGE_ID.'/feed', 'POST', $attachment);
  • 写回答

1条回答 默认 最新

  • dsa4214 2013-11-14 12:38
    关注

    Before using facebook api methods, you need get access token. May be this example will be useful for you https://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php

    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比