#143: Using and Caching Third-Party JSON with WordPress
On the design of CSS-Tricks as I record this, one of the things I wanted to add was a "Front End Design & Development Jobs" widget, powered by the CodePen Job Board. Those jobs are available as JSON data.
I want to do this with PHP so the jobs are there as part of the document as it comes down from the server. PHP (and WordPress) can totally make requests to third-party content just like an Ajax request can. In fact it's even easier, since there aren't cross-domain restrictions and JSONP type stuff involved.
But relying on a third-party request for the server to respond at all is a little risky. I wouldn't want to require it for every page load on CSS-Tricks. Fortunately, that's what WordPress Transients are for. In this video that's exactly what we use. We go get the data every once in a while, then cache it locally so most requests are super fast local data.