首页 文章

如何使用facebook api从我的墙上提供图片和视频

提问于
浏览
0

我正在使用facebook API

https://graph.facebook.com/PAGE_ID/feed?access_token=ACCESS_TOKEN

它不会从新闻Feed中获取所有内容,例如我的朋友在我的墙上分享的图片,视频,我被标记的帖子 . 怎么做?

1 回答

  • 1

    您需要将正确的GET变量提供给Graph Api,如下所示:

    734778xxx?fields=id,name,photos.fields(images,icon),email,posts.fields(comments.fields(message))
    

    转到此页面并自行测试https://developers.facebook.com/tools/explorer

    如果你需要单独的令牌,你可以构建这样的东西,

    <?php 
     require_once("facebook.php");//download & more info here https://developers.facebook.com/docs/reference/php/
    
     $config = array(
       'appId' => FBAPPID,
       'secret' => FBAPPSECRET,
    );
    $facebook = new Facebook($config);
    $fbuserid = $facebook->getUser();
    
    $params = array(
    "scope" => "read_stream,email,user_about_me", //here you ask for the parameters you need
    "redirect_uri" => "http://www.yoursite.com/"
    );
    
    //getting the info
    $user_profile = $facebook->api('/me','GET');
    $fname = $user_profile["first_name"];
    $lname = $user_profile["last_name"];
    $email = $user_profile["email"];
    
    ?>
    

相关问题