Witam. Mam taki oto (poniższy) skrypt statystyk. Chciałbym go przerobić tak, aby rekord słuchaczy zapisywał do oddzielnego pliku txt. Czy jest taka możliwość?? Jeśli tak, to prosiłbym o wskazówki.
<?php
$nag = \"Radio\";
$text = '';
$hosty = array(\"serwer\"); // tutaj daj IP servera
$porty = array(\"port\"); // a tutaj port
$l = 0;
while ($l < count($hosty)) {
$ktory = $l + 1;
// Connect to server
$fp1 = @fsockopen($hosty[$l], $porty[$l], &$errno, &$errstr, 10);
if (!$fp1) {
$text .= \"Server $ktory - Wyłączony
\";
} else {
// Get data from server
fputs($fp1, \"GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n\");
// exit if connection broken
for($i = 0; $i < 1; $i++) {
if (feof($fp1)) break;
$fp_data1 = fread($fp1, 31337);
usleep(500000);
}
// Strip useless junk from source data
$fp_data1 = ereg_replace(\"^.*\", \"\", $fp_data1);
$fp_data1 = ereg_replace(\".*\", \"\", $fp_data1);
// Place values from source into variable names
list($current1, $status1, $peak1, $max1, $reported1, $bit1) = explode(\",\", $fp_data1, 7);
$z2 = $current1;
$rekord2 = $peak1;
$pojemnosc2 = $max1;
if ($status1 == \"1\") {
(jakość $bit1 kbps)
\";
$text .= \"Rekord słuchaczy: $rekord2
\";
} else {
$text .= \"Server $ktory - Wyłączony
\";
$z2 = 0;
$rekord2 = 0;
$max1 = 0;
}
}
$text .= \"
\";
$l++;
}
$text = \"\" . $text . \"
\";
print $text;
?>