time() - 60*60){ // If a cache file exists, and it is newer than 1 hour, use it $jsonData = json_decode(file_get_contents($cache)); } else { $jsonData = json_decode((file_get_contents($url))); file_put_contents($cache,json_encode($jsonData)); } $result = '
'.PHP_EOL; foreach ($jsonData->data as $key=>$value) { $result .= "\t".''.$value->caption->text.''.PHP_EOL; } $result .= '
'.PHP_EOL; return $result; } echo get_instagram(); ?>