Cutest 404 page ever!

Screen Shot 2013-05-31 at 3.44.05 PM

I wrote an easy to use API for displaying cute animal pictures on any webpage.The API uses my website iGoAww.com, and chooses a random picture from amongst tens of thousands of adorable animal pictures.

To use this free API, just request http://www.igoaww.com/api.php, and a JSON string will be returned containing the image URL and caption.

This is an example:

{“url”:”http:\/\/i.imgur.com\/ElNcPxF.jpg”,”caption”:”My parents got a new dog. We named it Bruce.”}

You can use the following code to parse the JSON and display the resulting HTML:

[code lang=’php]
$jsonString = file_get_contents(“http://www.igoaww.com/api.php”);
$jsonArray = json_decode($jsonString, true);
$imageUrl = $jsonArray[‘url’];
$caption = $jsonArray[‘caption’];
echo “<br>While we work to fix it, we hope you enjoy this cute animal picture!<br>
Courtesy of <a href=’http://www.igoaww.com’>iGoAww.com</a><br>
<img style=’max-height: 700px; max-width: 700px;’ src=’$imageUrl’><br>$caption”;[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *