I remove JSON extraction from inline and use JavaScript to call AJAX. From there, you can run JSON through a separate PHP script on your site and add some additional caching, such as apc, to speed up the PHP call.
In apc caching, you will need mod_apc. Check out the apc_fetch and apc_store function calls you can use to cache JSON without requiring an expensive call so often.
If you make a GET request where all the API parameters are in the URL, you can do something similar to speed up repeated AJAX requests.
$url = "http://songkick.com/api/url/to/whatever"; $apcKey = "url:$url"; $data = apc_fetch($apcKey); if(!$data) { $data = file_get_contents($url); //or curl, or whatever you're using. apc_store($apcKey, $data); //save for next time. } echo $data;
source share