Return a List of links in reddit using PHP

php, reddit

Solution

$array = (array) json_decode(file_get_contents("http://www.reddit.com/.json"));

That will return a PHP array with all the data from the front page. You can limit how many you display using a simple while() loop.

This is very simple now that you have the array from above, because all you have to do is step through it.

Problem

Just wondering if someone has sample code to return the top 25 links of reddit (using PHP). In JSON or XML. i can't wrap my head around the API... and rarely use python.

Original source