Skip to content

Instantly share code, notes, and snippets.

Created January 2, 2013 19:01
Show Gist options
  • Save anonymous/4436930 to your computer and use it in GitHub Desktop.
Save anonymous/4436930 to your computer and use it in GitHub Desktop.
PHP code to display the top 10 posts from 9GAG using the InfiniGAG API.
<?php
$jsonurl = "http://infinigag.eu01.aws.af.cm/";
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json, TRUE);
foreach($json_output['images'] as $key => $thisValue)
{
$arrayImage = $thisValue['image'];
$title = $thisValue['title'];
$url = $thisValue['url'];
$votes = $thisValue['votes'];
$image = $arrayImage['big'];
echo '</br>';
echo '</br>';
echo $title;
echo '</br>';
echo 'Votes:', $votes;
echo '</br>';
echo '<a href="', $url, '" target="_blank"><img src=', $image, '/> </a>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment