<?php echo "<meta http-equiv='refresh' content='10'>"; $ip = "localhost"; $port = "8000"; $ice2_station = "Сервер вещания:"; $page = ""; $fp = @fsockopen("$ip", $port, $errno, $errstr, 10); $success=-999; if(!$fp) { $success=2; //Если сервер вещания не запущен echo' <tr> <td align="center" width="100%" colspan="2"><b> <font face="Arial" size="3" style="font-size: 9pt; "> <span style="color: rgb(255, 255, 255);"> Эфир <br> временно отключен!</b></td> </tr> '; } if($success!=2) //if connection { fputs($fp,"GET /status2.xsl HTTP/1.0\r\nUser-Agent: Icecast2 XSL Parser (Mozilla Compatible)\r\n\r\n"); //get status2.xsl while(!feof($fp)) { $page .= fgets($fp, 1000); } fclose($fp); //close connection $page = ereg_replace(".*<pre>", "", $page); $page = ereg_replace("</pre>.*", ",", $page); $numbers = explode(",",$page); $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]; $mount = $numbers[11]; $connections = $numbers[12]; $station =$numbers[13]; $listeners = $numbers[14]; $description = $numbers[15]; $cur_song = $numbers[16]; $www_url = $numbers[17]; //Если сервер вещания запущен, но нет потока if (strlen($mount)<2) echo ' <tr> <td align="center" width="100%"><b> <font face="Arial" size="3" style="font-size: 9pt; "> <span style="color: #6c6565;"><b>Статус эфира:</b></span> <span style="color: #ff0000;">Технические работы на сервере!</b></span></td> </tr> </tr> <br><br> <tr> <td align="center" width="100%"><b> <font face="Arial" size="3" style="font-size: 9pt; "> <span style="color: #6c6565;"><b>Слушателей:</b> 0</b></span></td> </tr> '; //Если сервер вещания запущен и идёт поток else echo ' <tr> <td align="center" width="100%"><b> <font face="Arial" size="3" style="font-size: 9pt; "> <span style="color: #6c6565;"><b>Эфир ведет:</b> '.$description.'</b></span></td> </tr> <br> <tr> <td align="center" width="100%"><b> <font face="Arial" size="3" style="font-size: 9pt; "> <span style="color: #6c6565;"><b>В эфире:</b> '.$cur_song.'</b></span></td> </tr> <br> <tr> <td align="center" width="100%"><b> <font face="Arial" size="3" style="font-size: 9pt; "> <span style="color: #6c6565;"><b>Слушателей:</b> '.$listeners.'</b></span></td> </tr> '; } ?>
<pre> MountPoint,Connections,Stream Name,Current Listeners,Description,Currently Playing,Stream URL Global,Client:2162 Source: ,,0,, </pre>
<?php $fl = file_get_contents('http://109.194.162.95:9300/'); if (preg_match('#<td>Current Song\:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui',$fl,$m)) { $song = $m[1]; echo "<b>Now playing:</b> {$song}<br \>"; } else { echo "<b>Now playing:</b> Нет потока<br \>"; } ?>
if (preg_match('#<td>Current Song\:<\/td>\n<td class=\"streamdata\">(.*)<\/td>#Ui',$fl,$m)) {
<?PHP error_reporting(0); $data = file("/usr/local/share/icecast/logs/playlist.log"); $track_count=0; for($i=count($data)-2;$i>0;$i--){ $mass = explode("|",$data[$i]); if ($mass[1] == '/play_64_aac'){ if ($track_count>0){ echo $mass[3]."<br>"; } if ($track_count++==5) break; } } ?>
<meta http-equiv="refresh" content="60"> <?php $xml[1] = simplexml_load_file("http://s1.edmradio.ru:8000/live.xspf"); $xml[2] = simplexml_load_file("http://s1.edmradio.ru:8000/play.xspf"); $xml[3] = simplexml_load_file("http://s1.edmradio.ru:8000/128.xspf"); $xml[4] = simplexml_load_file("http://s1.edmradio.ru:8000/64m.xspf"); $xml[5] = simplexml_load_file("http://s1.edmradio.ru:8000/48aac.xspf"); $xml[6] = simplexml_load_file("http://s1.edmradio.ru:8000/32aac.xspf"); //по необходимости увеличиваем $kp=6; //количество потоков $i=1; $vsego=0; while ($i <= $kp) { $ano = $xml[$i]->trackList->track->annotation; $mass=explode("\n", $ano); $kol=substr($mass[4],19); $i=$i+1; $vsego=$vsego+$kol; } echo "<b>Всего слушает: </b>" .$vsego; ?>
<meta http-equiv="refresh" content="60"> <?php $xml[1] = simplexml_load_file("http://s1.edmradio.ru:8000/live.xspf"); $xml[2] = simplexml_load_file("http://s1.edmradio.ru:8000/play.xspf"); $xml[3] = simplexml_load_file("http://s1.edmradio.ru:8000/128.xspf"); $xml[4] = simplexml_load_file("http://s1.edmradio.ru:8000/64m.xspf"); $xml[5] = simplexml_load_file("http://s1.edmradio.ru:8000/48aac.xspf"); $xml[6] = simplexml_load_file("http://s1.edmradio.ru:8000/32aac.xspf"); $vsego=0; foreach ($xml as $m) { $ano = $m->trackList->track->annotation; $mass=explode("\n", $ano); $vsego += substr($mass[3],19); /* у меня почему-то так: 0 - Stream Title, 1 - Stream Description, 2 - Content Type, 3 - Current Listeners, 4 - Peak Listeners, 5 - Stream Genre*/ } echo "<b>Всего слушает: </b>" .$vsego; ?>
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" > <xsl:output omit-xml-declaration="yes" method="text" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="no" encoding="UTF-8" /><xsl:strip-space elements="*"/> <xsl:template match = "/icestats" > <xsl:value-of select="listeners" /> </xsl:template> </xsl:stylesheet>
<?php $fl = file_get_contents('http://radio.tehmir.com.ua:8000/status.xsl?mount=/tech_radio'); function antara($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); } $song = antara($fl, "<td>Current Song:</td>\n<td class="streamdata">", "</td>"); echo "В эфире",$song; ?>
Current Song:", ""); echo "В эфире",$song; ?>
<tr><td>Current Song:</td><td class="streamdata"> <xsl:if test="artist"><xsl:value-of select="artist" /> - </xsl:if><xsl:value-of select="title" /></td></tr>
$song = antara( $fl, '<td>Current Song:</td>\n<td class="streamdata">', '</td>');
Current Song:\n', ''); echo "В эфире",$song; ?>
$song = antara($fl, "<td>Current Song:</td>\n<td class=\"streamdata\">", "</td>"); echo "В эфире: " . $song; ?>