Хм , помогите плз со скриптом разобраться. Он стандартный по идее т, только чуток переделанный. Под Айскаст. Отображает почему то только слушателей на 128 маунте , как сделать что бы отображал сумму слушателей 128 и 64 маунтов?
Сам скрипт:
<?php
$key_name = "radio_online";
$cache_timeout = 5;
$connect_timeout = 1;
$ip = "fm.asterios.tm"; //your server address in the form of mydomain.com or 192.161.1.1
$port = "8500"; //the port of your server
$ice2_station = "Radio Asterios"; // your station or stream name
eaccelerator_lock($key_name);
$status = eaccelerator_get($key_name);
if($status) {
eaccelerator_unlock($key_name);
echo $status;
exit;
}
$fp = fsockopen("$ip", $port, &$errno, &$errstr, $connect_timeout); //open connection
if($fp) {
fwrite($fp,"GET /status2.xsl HTTP/1.0\r\nUser-Agent: Icecast2 XSL Parser (Mozilla Compatible)\r\n\r\n"); //get status2.xsl
stream_set_timeout($fp, $connect_timeout);
$page = '';
while(!feof($fp)) {
$page .= fgets($fp, 4096);
}
fclose($fp); //close connection
$page = ereg_replace(".*<pre>", "", $page); //extract data
$page = ereg_replace("</pre>.*", ",", $page); //extract data
$numbers = explode(",",$page); //bomb it and extract data
$mount = $numbers[0];
$connections = $numbers[1];
$stream_n = $numbers[2];
$listeners = $numbers[3];
$desc = $numbers[4];
$cur_song = $numbers[5];
$str_url = $numbers[6];
$client_info = $numbers[7];
$test1 = $numbers[8]; //set vars that where empty and still dont know what the heck those values are ;-)
$test2 = $numbers[9]; //set vars that where empty and still dont know what the heck those values are ;-)
$test3 = $numbers[10]; //set vars that where empty and still dont know what the heck those values are ;-)
$mount = $numbers[11];
$connections = $numbers[12];
$station =$numbers[13];
$listeners = $numbers[14];
$description = $numbers[15];
$cur_song = $numbers[16];
$www_url = $numbers[17];
//edit html to fit your stations site, this display is for online status
$status = "$listeners";
} else {
$status = '<table>
<tr>
<td width="100%" colspan="2">
<img border="0" src="images/offline.gif" width="22" height="22">
<b><font face="Arial" size="2" color="#FF0000">'.$ice2_station.' is currently offline</font></b></td>
</tr>
</table>';
}
eaccelerator_put($key_name, $status, $cache_timeout);
eaccelerator_unlock($key_name);
echo $status;
?>