<?php $data = file_get_contents('url/status.xsl?mount=/live'); 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); } if(antara($data, "Mount started:</td>\n<td class=\"streamdata\">","</td>") ==''){$data = file_get_contents('url:88/status.xsl?mount=/nonstop');} $data = iconv("utf-8", "cp1251", $data); $title = antara($data, "Stream Title:</td>\n<td class=\"streamdata\">","</td>"); $description = antara($data, "Stream Description:</td>\n<td class=\"streamdata\">","</td>"); $content_type = antara($data, "Content Type:</td>\n<td class=\"streamdata\">","</td>"); $Mount_started = antara($data, "Mount started:</td>\n<td class=\"streamdata\">","</td>"); $Bitrate = antara($data, "Bitrate:</td>\n<td class=\"streamdata\">","</td>"); $Current_listeners = antara($data, "Current Listeners:</td>\n<td class=\"streamdata\">","</td>"); $Peak_listeners = antara($data, "Peak Listeners:</td>\n<td class=\"streamdata\">","</td>"); $Stream_genre = antara($data, "Peak Listeners:</td>\n<td class=\"streamdata\">","</td>"); $Stream_url = antara($data, "Stream URL:</td>\n<td class=\"streamdata\">","</td>"); $Current_song = antara($data, "Current Song:</td>\n<td class=\"streamdata\">","</td>"); $hellp_curr_listeners = antara($hellp, "Сейчас слушают:</td>\n<td class=\"streamdata\">","</td>"); $hellp_peak_listeners = antara($hellp, "Максимум было</td>\n<td class=\"streamdata\">","</td>"); $Curr_listens=$Current_listeners2+$Current_listeners+$hellp_curr_listeners; $Peak_listens=$Peak_listeners2+$Peak_listeners+$hellp_peak_listeners; $staylst=$Curr_listens+1; echo '<span style="font-size: 0.72em; font-family:Trebuchet MS, Tahoma, Arial, sans-serif; color:#3090c3"><b>Название радио:</b> '.$title.' <br> <b>За пультом:</b> '.$description.' <br> <b>Битрейт:</b> '.$Bitrate.' <br> <b>Сейчас слушают:</b> '.$Curr_listens.' <br> <b>Максимум слушало:</b> '.$Peak_listens.' <br> <b>Сейчас в эфире:</b> '.$Current_song.' <br> <br> <center><input type="button" value="Слушать радио" onclick="location.href=\'url:88/live.m3u\'" /></center>'; ?>
<?php function get_title ($mount){ $r=fopen($mount,'r'); $text=fread($r,2000); fclose($r); $mass=explode(",", $text); return $mass [16]; } $mount1 = "ссылка на status2xsl первого маунта"; $mount2 = "--//-- второго --//--"; $mount3 = "--//-- третьего --//--"; if(get_title($mount1) !='') { echo get_title($mount1); } elseif(get_title($mount2) !='') { echo get_title($mount2); } else { echo get_title($mount3); } ?>
<?php $data = file_get_contents('http://127.0.0.1:88/status.xsl?mount=/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); } if(antara($data, "Content Type:</td>\n<td class=\"streamdata\">","</td>") ==''){$data = file_get_contents('http://127.0.0.1:88/status.xsl?mount=/nonstop');} $Mount_started = antara($data, "Content Type:</td>\n<td class=\"streamdata\">","</td>"); $Current_song = antara($data, "Current Song:</td>\n<td class=\"streamdata\">","</td>"); $Curr_listens=$Current_listeners2+$Current_listeners+$hellp_curr_listeners; $Peak_listens=$Peak_listeners2+$Peak_listeners+$hellp_peak_listeners; $staylst=$Curr_listens+1; echo ''.$Current_song.''; ?>
$mass=explode(",", $text);
<?php function add_mnt($val) { $mnt_p = array(); for($i = 0, $pos = 0; $i < 6; $i++) { $pos = strpos($val, ','); $znach = ($pos == 0 ? ($i==5 ? $val : '') : substr($val, 0, $pos)); switch($i) { case 0: $mnt_p['mnt'] = $znach; break; case 3: $mnt_p['lst'] = $znach; break; case 5: $mnt_p['cur'] = $znach; break; } $val = substr($val, $pos+1); } return $mnt_p; } $handle = file("http://192.168.0.1:8000/status2.xsl"); $mass = $handle[5]; $mnt = array(); while($mass<>'') { $pos = strpos($mass, ',/'); if($pos == 0) { $mnt[] = add_mnt($mass); break; } else { $mnt[] = add_mnt(substr($mass, 0, $pos)); $mass = substr($mass, $pos+1); } } foreach ($mnt as $val) { echo $val['mnt'] ." ". $val['lst']."<br>"; } echo "Stations=".count($mnt).'<br>'; ?>