The purpose behind this project is the database for the Android and iPhone Quote of the Day app. This page essentially pulls the same information and behaves the same as the apps. It was necessary to get this page up and running before even beginning work on the apps.
This page is 100% complete. As of 9/21/2017, both of the mobile apps are complete too. Well, this was true until Nov, 2020 when I dropped support for all Apple apps and removed it from the store. So, we're back to only the Android version. Sorry.
Note 2020-11-21: I am making some upgrades to the API as well as a couple of the programs that go along with it. If things break, then things break. "I don't always test my code, but when I do, I test it in production" -Abraham Lincoln
Social icons appear here
NEW: As a matter of showing how the API can work on a site that is not this site, I created a full-page stand-alone version of this program. Literally all it does is call up the current quote. It also includes a "more" section to show the rest of the data that goes along with it, that is normally not seen.
I have created a Twitter Bot for this. If you don't want to download the app, you can follow the Twitter account, and get your daily quote there.Follow @DPQuoteOfTheDay
Current status of the apps - 08-15-2017: Android App is 100% finished.
An Application Programming Interface is an interface or communication protocol between a client and a server intended to simplify the building of client-side software. In short, if you need to perform the same function over and over again, like pulling a record from a database, it is sensible to write a single API that can be called from anywhere at any time, that does nothing but return the desired result.
We are making the API that makes this thing run open to anyone that wants to use it. The database now holds some 4 years worth of quotes. And there are always more coming in. Users submit new quotes about as often as I do. I have already used this project for a number of things, and I suspect that people would probably find it useful for their own projects. So we are allowing the API to be used openly. As long as this service doesn't get abused, it will remain free for the foreseeable future.
The link to call the API is:
Running the API right now will return the JSON:
[["293","God, please save me from your followers!","Bumper Sticker","Gabriel Robins","2017-07-24 00:00:00","","Internet","2023-02-04","http:\/\/www.cs.virginia.edu\/~robins\/quotes.html","Wisdom"]]
The argument "echoquote=2" tells the API to return just today. If you use "echoquote=3", it will return 30 days worth. It starts with today minus 1 week and goes out 3 weeks. The following code really only addresses a single quote. If you wish to use the 30-day version, modify the code to utilize the entire array, rather than just element .
This is easier than it sounds because it's already an array. You just need to know what the elements are:
3: Attributed to
4: Date Entered
7: Date FOR (today's date)
8: Link for attribution
The output can look like this:
Code for this:
Since I used PHP to call up the JSON, I used a PHP variable $quoteIs