$data = file_get_contents('http://4m.net.ua:8000/status.xsl?mount=/ZED-FM'); $data2 = file_get_contents('http://4m.net.ua:8000/status.xsl?mount=/ruskat'); $data3 = file_get_contents('http://62.149.27.186:8000/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); } $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, "Stream Genre:</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>"); //========якщо маунтів декілька============// $Current_listeners2 = antara($data2, "Current Listeners:</td>\n<td class=\"streamdata\">","</td>"); $Peak_listeners2 = antara($data2, "Peak Listeners:</td>\n<td class=\"streamdata\">","</td>"); //-----------------// $data3_curr_listeners = antara($data2, "Current Listeners:</td>\n<td class=\"streamdata\">","</td>"); $data3_peak_listeners = antara($data2, "Peak Listeners:</td>\n<td class=\"streamdata\">","</td>"); //======сумуємо в загальну кількість слухачів та піки=======// $Curr_listens=$Current_listeners2+$Current_listeners+$data3_curr_listeners; $Peak_listens=$Peak_listeners2+$Peak_listeners+$data3_peak_listeners; $staylst=$Curr_listens+1; echo ''.$title.' <br> '.$description.' <br> '.$content_type.' <br> '.$Mount_started.' <br> '.$Bitrate.' <br> '.$Curr_listens.' <br> '.$Peak_listens.' <br> '.$Stream_genre.' <br> '.$Stream_url.' <br> '.$Current_song.' <br><br>Слухачі по маунтам <br> Маунт-1: зараз '.$Current_listeners.', всього '.$Peak_listeners.'.<br> Маунт-2: зараз '.$Current_listeners2.', всього '.$Peak_listeners2.'.<br> Маунт-3: зараз '.$data3_curr_listeners.', всього '.$data3_peak_listeners.'.<br> ';
$data = file_get_contents('http://логин:пароль@сервер:8000/admin/listclients.xsl?mount=/ZED-FM'); 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); } $data = iconv("utf-8", "cp1251", $data); $data = antara($data, "<table border=\"0\" cellpadding=\"1\" cellspacing=\"5\" bgcolor=\"444444\"><tr><td align=\"center\">","</tr>\n</table>"); //$data = substr_replace (Action, "5", $data); $data=preg_replace('|<a[^>]+>([^<]+)</a>|ism',' ',$data); echo ''.$data.' ';
<?PHP $data = file_get_contents("http:/ip:port/status2.xsl?mount=/ваш_маунт"); $mass = explode(",",$data); $title = $mass[16]; $listeners = $mass[14]; echo "сейчас играет: ".$title." слушают: ".$listeners; ?>