如何在Facebook上获得照片的份额?

hun*_*eox 8 facebook facebook-graph-api

通过使用Graph API,我可以检索评论,喜欢内部和外部Facebook网址的数量.但我只能获得外部Facebook网址的股票数量

例如:

https://graph.facebook.com/?ids=http://www.youtube.com/watch?v=tu8BNocnVzc

但不是Facebook的一个:

http://graph.facebook.com/?ids=http://www.facebook.com/photo.php?fbid=364861533533284

如何获取Facebook对象的份额?

(我可以通过使用此URL获取喜欢和评论http://graph.facebook.com/364861533533284)

Jes*_*lle -1

您应该使用 FQL 并查询照片表https://developers.facebook.com/docs/reference/fql/photo或 link_stat 表https://developers.facebook.com/docs/reference/fql/link_stat ..

您可以在此处查看它如何提供结果:http://developers.facebook.com/tools/explorer?fql =SELECT%20url%2C%20normalized_url%2C%20share_count%2C%20like_count%2C%20comment_count%2C%20total_count% 2C%0Acommentsbox_count%2C%20comments_fbid%2C%20click_count%20FROM%20link_stat%20WHERE%20url%3D%22http%3A%2F%2Fwww.facebook.com%2Fphoto.php%3Ffbid%3D364861533533284%22

以下是如何使用 FQL 调用来获取结果:

    <?php 
        $img_url='http://www.facebook.com/photo.php?fbid=364861533533284';

        $query_url="https://api.facebook.com/method/fql.query?query=
                    select%20total_count,share_count,like_count,comment_count,
                    commentsbox_count%20from%20link_stat%20where%20
                    url='" . $directory_url . "'&format=json";

        $response = file_get_contents($query_url);
        $response_array = json_decode($response, true);
        $params=$response_array[0];


        $total_count=$params['total_count'];
        $like_count=$params['like_count'];
        $comment_count=$params['comment_count'];
        $share_count=$params['share_count'];

        ?>
Run Code Online (Sandbox Code Playgroud)