| 177 |
// do nothing. XXX: Add stats code here. |
// do nothing. XXX: Add stats code here. |
| 178 |
} |
} |
| 179 |
else { |
else { |
| 180 |
$f = fopen($file,"r"); |
if (function_exists('curl_init')) { |
| 181 |
$f2 = fopen($cache_filename,"w+"); |
$ch = curl_init(); |
| 182 |
while ($r = fread($f,8192)) |
curl_setopt($ch, CURLOPT_URL, $file); |
| 183 |
{ |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 184 |
fwrite($f2,$r); |
$file_contents = curl_exec($ch); |
| 185 |
} |
curl_close($ch); |
| 186 |
fclose($f2); |
} |
| 187 |
fclose($f); |
else { |
| 188 |
|
$file_contents = file_get_contents($file); |
| 189 |
|
} |
| 190 |
|
|
| 191 |
|
$fh = fopen($cache_filename, 'w+'); |
| 192 |
|
fwrite($fh, $file_contents); |
| 193 |
|
fclose($fh); |
| 194 |
} |
} |
| 195 |
return file_get_contents ($cache_filename); // Return the file contents from the cache |
return file_get_contents ($cache_filename); // Return the file contents from the cache |
| 196 |
} |
} |