<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></head><?php $ip = "ktkp.mine.nu"; $port = "82"; $ice2_station = "Радио KTKP"; $fp = fsockopen("$ip", $port, &$errno, &$errstr, 30); //open connection if(!$fp) { $success=2; //set if no connection //edit html to fit your stations site, this display is for offline status echo'<table> <tr> <td width="100%" colspan="2"> <img border="0" src="images/offline.gif" width="22" height="22"> <b><font face="Georgia" size="5" color="#FF0000">'.$ice2_station.' сейчас не работает</font></b></td> </tr> </table>'; } 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); //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 $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 '<table width="100%" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0"> <tr> <td width="100%"><b><font face="Arial" size="2"> <tr> <td width="100%"><b><font face="Georgia" color="green" size="5"> <img border="0" src="images/ice2_status/tunes.gif" width="22" height="18"> '.$ice2_station.' Не работает! </font></b></td> </tr> </tr> </table>'; //edit html to fit your stations site, this display is for online status else echo '<table width="100%" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0"> <tr><center> <td width="100%"><b><font face="Arial" size="2"> <tr> <td width="100%"><b><font face="Georgia" color="green" size="2"> '.$ice2_station.' <img border="0" src="online.jpg" width="110" height="20"> </font></b></td><center> </tr> <tr> <td width="100%"><b><font face="Georgia" color="red" size="2"> <img border="0" src="user.jpg" width="40" height="40"> Слушателей:'.$listeners.' </font></b></td> </tr> <tr> <td width="100%"><b><font face="Georgia" color="green" size="2"> <img border="0" src="radio_play.png" width="40" height="40"> Трек:'.$cur_song.' </font></b></td> </tr> </tr> </table>'; } ?></html>
if( mb_detect_encoding($string,"UTF-8, ISO-8859-1")!="UTF-8" ) {$string = utf8_encode($string);}
if( mb_detect_encoding($string,"CP1251, ISO-8859-1")!="UTF-8" ) {$string = utf8_encode($string);}
<html><head><meta http-equiv="Content-Type" content="text/html;></head> <charset>cp1251</charset> iconv('CP1251','UTF-8',$text); iconv('UTF-8','CP1251',$text); <?php $ip = "78.30.228.174"; $port = "8000"; $ice2_station = "HOT Radio"; $fp = fsockopen("$ip", $port, &$errno, &$errstr, 30); //open connection if(!$fp) { $success=2; //set if no connection //edit html to fit your stations site, this display is for offline status echo'<table> <tr> <td width="100%" colspan="2"> <img border="0" src="images/offline.gif" width="22" height="22"> <b><font face="Georgia" size="5" color="#FF0000">'.$ice2_station.' сейчас не работает</font></b></td> </tr> </table>'; } 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); //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 $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 '<table width="100%" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0"> <tr> <td width="100%"><b><font face="Arial" size="2"> <tr> <td width="100%"><b><font face="Georgia" color="green" size="5"> <img border="0" src="images/ice2_status/tunes.gif" width="22" height="18"> '.$ice2_station.' Не работает! </font></b></td> </tr> </tr> </table>'; //edit html to fit your stations site, this display is for online status else echo '<table width="100%" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0"> <tr><center> <td width="100%"><b><font face="Arial" size="2"> <tr> <td width="100%"><b><font face="Georgia" color="green" size="2"> '.$ice2_station.' <img border="0" src="online.jpg" width="110" height="20"> </font></b></td><center> </tr> <tr> <td width="100%"><b><font face="Georgia" color="red" size="2"> <img border="0" src="user.jpg" width="40" height="40"> Слушателей:'.$listeners.' </font></b></td> </tr> <tr> <td width="100%"><b><font face="Georgia" color="green" size="2"> <img border="0" src="radio_play.png" width="40" height="40"> Трек:'.$cur_song.' </font></b></td> </tr> </tr> </table>'; } ?></html>
echo' <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> </head> <body style="margin:0 0 0 0; background-color:#000; color:#fff"> <b><style="font-family:Arial; font-size:2;">В эфире: iconv('ISO-8859-1','UTF-8',$cur_song)</font></b> </body> </html>';