Witam, czy mógłby ktoś dodać coś do tego skryptu żeby automatycznie się on odświeżał?
<?php
// KONFIGURACJE
$config['ip'] = "4stream.pl"; // podajemy ip lub host serwera
$config['port'] = "18032"; // podajemy port serwera
$config['haslo'] = "XXX"; // podajemy haslo do nadawania na serwer shoutcast
// KONIEC KONFIGURACJII
/*=================================================================================*/
header('Content-type: text/html;charset=iso-8859-2');
$scfp = @fsockopen($config[ip], $config[port], &$errno, &$errstr, 30);
if (!$scfp)
{
echo '<font face="Verdana" size="2" color="#000000"><b>Docelowy serwer SHOUTcast jest wył±czony!</b></font>';
}
else
{
fputs($scfp,"GET /admin.cgi?pass=$config[haslo]&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp))
{
$page .= fgets($scfp, 1000);
}
$loop = array("STREAMSTATUS", "BITRATE");
$y=0;
while($loop[$y]!='')
{
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if ($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE)
{
$$scphp = urldecode($$scphp);
}
$y++;
}
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while($songatime[$r]!="")
{
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
$r++;
}
fclose($scfp);
$skroc = '50';
echo'<table cellspacing="0" cellpadding="0" background="http://eradia.pl/files/user/scsong.jpg" border="0" width="442">
<tr>
<td valign="top" height="0">
<font face="Verdana" size="2" color="#000000">
<br>
<p style="margin-top: 6; margin-bottom: 0"> '; if (strlen($song[1])>$skroc) { echo substr($song[1], 0, $skroc).'...'; } else { echo $song[1]; } echo '</p>
<p style="margin-top: 6; margin-bottom: 0"> '; if (strlen($song[2])>$skroc) { echo substr($song[2], 0, $skroc).'...'; } else { echo $song[2]; } echo '</p>
<p style="margin-top: 7; margin-bottom: 0"> '; if (strlen($song[3])>$skroc) { echo substr($song[3], 0, $skroc).'...'; } else { echo $song[3]; } echo '</p>
<p style="margin-top: 6; margin-bottom: 0"> '; if (strlen($song[4])>$skroc) { echo substr($song[4], 0, $skroc).'...'; } else { echo $song[4]; } echo '</p>
<p style="margin-top: 7; margin-bottom: 0"> '; if (strlen($song[5])>$skroc) { echo substr($song[5], 0, $skroc).'...'; } else { echo $song[5]; } echo '</p>
<p style="margin-top: 7; margin-bottom: 0"> '; if (strlen($song[6])>$skroc) { echo substr($song[6], 0, $skroc).'...'; } else { echo $song[6]; } echo '</p>
</font>
</td>
</tr>
</table>';
}
?>
Ale w taki sposób żeby odświeżała się tylko ta część strony a nie cała strona.