Get wall feed from a public Facebook page using Graph API - is it really this complex?

佐手、 提交于 2019-12-02 23:24:28

Two years later, you can programmatically do this with a Facebook App (an example using PHP and Slim): https://developers.facebook.com/apps/

$base_api="https://graph.facebook.com/";
$client_id="XXXXXX";
$app_secret="XXXXXX";

//get a profile feed (can be from a page, user, event, group)
$app->get('/feed/:profileid/since/:start_date', function ($profile_id,$start_date) {

    $start_time=date('m/d/Y h:i:s',$start_date);

    $request = new FacebookRequest(
      getSession(),
      'GET',
      '/'.$profile_id.'/feed?since='.$start_time
    );

    $response = $request->execute();
    $graphObject = $response->getGraphObject();

    //do something with $graphObject

});


function getSession(){
    $session = new FacebookSession(getAccessToken());
    return $session;
}


function getAccessToken(){
    global $base_api, $client_id, $app_secret;
    $url=$base_api."oauth/access_token?client_id=".$client_id."&client_secret=".$app_secret."&grant_type=client_credentials";
    $str = file_get_contents($url);
    $token = str_replace ( "access_token=" , "" , $str );
    return $token;
}

I have some success with reading in the direct feed without tokens etc. (using magpie, simplepie or querypath or similar).

http://www.facebook.com/feeds/page.php?format=rss20&id=........ http://www.facebook.com/feeds/page.php?format=atom10&id=........

found on: http://ahrengot.com/tutorials/facebook-rss-feed/

craned

Facebook has changed how to retrieve a public Facebook page's feed since the other answers were posted.

Check out my answer/question. It's not PHP, but it provides the URLs and process you need.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!