how can i cache data that took from a txt file before?




Güncel : is a category name in the txt file.
BCList2.txt : data file from another site
problem : the txt file is too big. it has lots of categories in it. i
need only "Güncel" category. also it is too slow to show that category
in my page. so i want to cache it maybe in a txt file in my server. so
second time that i need the data it won't be too slow. i want to take
the data once in a day but show several times. the code below is
working as well as i need. but it is too slow to open every time
refresh my page. if any suggestions, thank you.

here is the code

<?
if (!$kategori_haber) $kategori_haber = array("Güncel");
$satir = file("http://www.ntvmsnbc.com/news/BCList2.txt";) or
die("Serverla iletişim sağlanamadı!");
for ($x = 0; $x < sizeof($kategori_haber); $x++) {
for ($i = 0; $i < sizeof($satir); $i++) {
if (trim($satir[$i]) == "+$kategori_haber[$x]") {
$bas = $i + 2;
break;
}
}
for ($i = $bas; $i < sizeof($satir); $i++) {
if (substr($satir[$i], 0, 1) == "+" || $i == sizeof($satir) - 1) {
$son = $i;
break;
}
}
for ($i = $bas; $i < $son; $i++) {
$yazi = trim($satir[$i]);
if ($yazi != "-" && !eregi("$kategori_haber[$x] Güncel", $yazi)) {
$yazi = str_replace("/news/./", "http://www.ntvmsnbc.com/news/";,
$yazi);
$haber_e = explode("|", $yazi);
$haber_e[0]=str_replace("http://www.ntvmsnbc.com/news/";, "",
$haber_e[0]);
echo "·<font face=verdana size=1>&nbsp;<a href=\"http://
www.ntvmsnbc.com/news/$haber_e[0]\" target=_blank >$haber_e[1]</a></
font></br>\n";
}
}
}
?>

.



Relevant Pages

  • RE: docmd.sendobject
    ... It does not refresh when user click the second time. ... It keeps the same result even user click on other account number. ... The code works for first time, but the report does not refresh when I run ...
    (microsoft.public.access.reports)
  • Re: how can i cache data that took from a txt file before?
    ... Personally I think I'd do that with a cron job once a day to fetch the data and build the page. ...
    (comp.lang.php)
  • Re: Non-Harmonic harmonies
    ... track it but with echo applied the second time around. ... track that didn't quite match up to the main vocal track. ... interested) - it doesn't mention any particular songs, ...
    (rec.music.beatles)
  • Cant sent with USB->RS232 converter
    ... I'm trying to use two USB to RS232 converters on my ... RHES4 server. ... I can send data one time, but the second time RT and DTR ... echo 1> /dev/ttyUSB0 ...
    (linux.redhat)
  • Re: Non-Harmonic harmonies
    ... (As opposed to a harmony!) ... track it but with echo applied the second time around. ... track that didn't quite match up to the main vocal track. ...
    (rec.music.beatles)