php refresh on 2nd page refresh
- by cnotethegr8
i have this function that gives me an output of a number. (the number is my total amount of downloads from my iphone themes.)
because the code has to make so many requests, it loads the page very slowly.
what would be the best way for me to go about the code loading into a variable and than calling it on the second page refresh. so it dosnt take so long to load?
or any other method will do. i just want it to not take so long to load!
also this isnt on my server so i cant use $.ajax
<?php
function all_downloads() {
$allThemes = array(
'com.modmyi.batterytheme',
'com.modmyi.connectiontheme',
'com.modmyi.icontheme',
'com.modmyi.percenttheme',
'com.modmyi.statusnotifiertheme',
'com.modmyi.cnote',
'com.modmyi.iaccescnotekb',
'com.modmyi.cnotelite',
'com.modmyi.multibrowsericon',
'com.modmyi.changeappstoreiconwithinstallous'
);
$total = 0;
foreach($allThemes as $com_modmyi){
$theme = file_get_contents( "http://modmyi.com/cstats/index.php?package=".$com_modmyi.'&output=number');
$theme = str_replace(",","", $theme);
$almost_done += $theme;
$rock_your_phone = 301; //From c-note and Multi Lock Screen Theme on Rock Your Phone
$total = ($almost_done + $rock_your_phone);
}
echo number_format($total);
}
?>