I'm really really new on using APIs. I have been trying to grab data from reddit to analyse them.
Currently I'm trying with a small testing code, but the data it gives is not in a order.
<?php
$array = (array) json_decode(file_get_contents("http://www.reddit.com/.json"));
foreach ($array as $key=>$string) {
var_dump($array);
}
?>
How the output comes with the above code
I don't know whether I'm taking the right approach according to my objective. So what I really want to do is capture all new posts until we reach 10,000 and follow those posts every day to log the number of upvotes, comments and the ranking.
Please tell some tips and guides to grab the data that I need?