-3

I have been trying get data out of new reddit post, but theres limitation where you cant get data from more than 100 posts. can anybody help me to getover this below is my code

$output = "";
    for($digit=0; $digit<1000; $digit+=25){
        $jsondata = trim(file_get_contents("http://www.reddit.com/new/.json?count=$digit"));

        $json = json_decode($jsondata, true);

        $moviesChildren = $json['data']['children'];
        foreach($moviesChildren as $movie){

            $output .= '"'.$movie["data"]["title"].'", ';
            $output .= $movie["data"]["ups"].", ";
            $output .= $movie["data"]["num_comments"].", ";
            $output .= $movie["data"]["domain"]."\n\r";
            $output .= "<br />";

        }

    }
    echo $output;
Prog_Rookie
  • 438
  • 7
  • 23

1 Answers1

0

What is the output you get, and what are you expecting instead?

First off, you will want to follow the API rules about authentication or else you'll be quickly limited, and possibly banned.

Listings have before and after attributes to help with pagination. You will need to pass those into your subsequent GETs in order to fetch the next page.

Xiong Chiamiov
  • 13,076
  • 9
  • 63
  • 101