开发者

Retrieve facebook posts more than its default limit

Is there a method to retrieve more posts from facebook? I am developing a site which needs to retrieve at least 200 posts from facebook. Right now I am getting 24 posts only. Is it possible to get 200 posts?

 $user_posts = json_decode(@file_get_contents(
           'https://graph.facebook.com/me/posts?access_token='.$access_token));
$user_posts = (array)$user_posts;
$user_posts = $user_posts['data'];
echo "<h1>Posts</h1>";
foreach($user_posts as $user_post){
    $user_post = (array)$user_post;

    echo "<table border='8' width='500'>";
    if(($user_post['picture'])||($user_post['message'])){
        开发者_Python百科echo "<tr>";
        echo '<td height="4"></td>';
        echo "<td>";
        if($user_post['message']){
            echo "<tr><td>Message : ".$user_post['message']."</td></tr>";
        }
           }
    }

Thanks.


I found the answer for this one. Just add a limit field to the url.

$user_posts = json_decode(@file_get_contents( 'https://graph.facebook.com/me/posts?access_token='.$access_token.'&limit=200'));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜