Skip to content

Instantly share code, notes, and snippets.

@terinjokes
Created December 6, 2011 21:42
Show Gist options
  • Save terinjokes/1440131 to your computer and use it in GitHub Desktop.
Save terinjokes/1440131 to your computer and use it in GitHub Desktop.
Fortune Web API
<?php
# A server I use doesn't have fortune installed, so created this small script to fetch one from a web api and display it on login
$json = file_get_contents("http://www.iheartquotes.com/api/v1/random?source=prog_style+osp_rules+math+humorix_misc+oneliners+riddles&format=json", "r");
$json = json_decode($json);
echo wordwrap($json->quote);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment