<font color="9db1cc"><?php header("Content-Type: text/html; charset=windows-1251"); 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);} $fl = file_get_contents("localhost/json.xsl?mount=/mp3"); if($rj == "0" or $rj == "")( echo "<img src='ONAIR/LIFE.jpg'>"; $fl = file_get_contents('localhost/status.xsl?mount=/mp3'); }else{ switch ($rj) { case "DJLILIT": echo "<img src='ONAIR/ONDJLILIT.jpg' wight=100%>"; break; case "DJARTIST": echo "<img src='ONAIR/ONDJARTIST.jpg' wight=100%>"; break; case "DJVOLF": echo "<img src='ONAIR/ONDJVOLF.jpg' wight=100%>"; break;}} $stream = antara($fl,"<td>Stream Title:</td>\n<td class=\"streamdata\">","</td>"); $description = antara($fl, "<td>Stream Description:</td>\n<td class=\"streamdata\">", "</td>"); $listeners = antara($fl, "<td>Current Listeners:</td>\n<td class=\"streamdata\">", "</td>"); $max = antara($fl, "<td>Peak Listeners:</td>\n<td class=\"streamdata\">", "</td>"); $song = antara($fl, "<td>Current Song:</td>\n<td class=\"streamdata\">", "</td>"); echo "<br>В эфире <b>".$stream."</b> <br>Слушает - ".$listeners."<br>Слушало максимум - ".$max."<br>Сейчас Играет - ".$song; ?> </font>
<?php //Расшифровываем данные, полученные в формате JSON $status = json_decode(file_get_contents('http://my-cool-radio.org:8080/status-json.xsl?mount=/coolmount'), true); //Для примера выводим данные о стриме foreach ($status["icestats"]["source"] as $key => $value) { echo $key . " = " . $value . "<br />"; } ?>