What's more fun than putting LOLCATS on your page? And getting a random, different animated cat every time? We can easily do this using the awesome Giphy API!
In this case, we're telling Giphy to give us:
- One image
- Chosen at random
- "G" rated
- Search keywords "funny cat"
- And we provide the "public beta" API key (See their notes about usage)
div on our page called
#fetch-result). Note that Fetch API’s support isn’t yet that great, so we’re using a polyfill to extend support across browsers.
And, here’s an easy way to do it using PHP’s