得到喜欢和评论使用图表api计算页面facebook的相册

时间:2016-10-05 05:55:57

标签: php html facebook facebook-graph-api

有没有办法检查我的网页相册中的喜欢和评论?我已经使用此代码提出请求:

    $fields="id,name,description,link,cover_photo,count,likes.limit(0).summary(1),comments.limit(0).summary(1)";
    $fb_page_id = "my page id";
    $access_token="my access token";

    $json_link = "https://graph.facebook.com/v2.7/{$fb_page_id}/albums?fields={$fields}&access_token={$access_token}";
    $json = file_get_contents($json_link);

    $obj = json_decode($json, true, 512, JSON_BIGINT_AS_STRING);



    for($x=0; $x<$album_count; $x++){

    $id = isset($obj['data'][$x]['id']) ? $obj['data'][$x]['id'] : "";
    $name = isset($obj['data'][$x]['name']) ? $obj['data'][$x]['name'] : "";
    $url_name=urlencode($name);

    $description = isset($obj['data'][$x]['description']) ? $obj['data'][$x]['description'] : "";
    $link = isset($obj['data'][$x]['link']) ? $obj['data'][$x]['link'] : "";

    $cover_photo = isset($obj['data'][$x]['cover_photo']['id']) ? $obj['data'][$x]['cover_photo']['id'] : "";
    $count = isset($obj['data'][$x]['count']) ? $obj['data'][$x]['count'] : "";

    $likes = count($obj['data'][$x]['likes']) ? $obj['data'][$x]['likes'] : "";
    $comments = count($obj['data'][$x]['comments']) ? $obj['data'][$x]['comments'] : "";

但我无法获得有多少喜欢和评论我的特定专辑页面facebook的数据。 有没有人知道如何获得Facebook专辑和评论计数?非常感谢提前!

0 个答案:

没有答案