<?php $scdef = "your message"; $scip = "IP"; $scport = "Порт"; $scpass = "Пароль"; $scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30); if(!$scfp) { $scsuccs=1; echo''.$scdef.' is Offline'; } if($scsuccs!=1){ fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"); while(!feof($scfp)) { $page .= fgets($scfp, 1000); } ###################################################################################################################### /////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ //define xml elements $loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "BITRATE", "ICQ", "AIM"); $y=0; while($loop[$y]!=''){ $pageed = ereg_replace(".*<$loop[$y]>", "", $page); $scphp = strtolower($loop[$y]); $$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed); if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE) $$scphp = urldecode($$scphp); // uncomment the next line to see all variables //echo'$'.$scphp.' = '.$$scphp.'<br>'; $y++; } //end intro xml elements ###################################################################################################################### ###################################################################################################################### /////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ //get song info and history $pageed = ereg_replace(".*<SONGHISTORY>", "", $page); $pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed); $songatime = explode("<SONG>", $pageed); $r=1; while($songatime[$r]!=""){ $t=$r-1; $playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]); $playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]); $song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]); $song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]); $song[$t] = urldecode($song[$t]); $dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page); $dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed); $r++; } //end song info fclose($scfp); } header ("Content-type: image/png"); $im = ImageCreateFromPng("rj.png"); $color = imagecolorallocate ($im, 0, 0, 0); imagettftext ($im, 8, 0, 20, 15, $color, "verdana.ttf", "On AIR: $servertitle"); imagettftext ($im, 8, 0, 20, 30, $color, "verdana.ttf", "Song: $song[0]"); imagettftext ($im, 8, 0, 20, 45, $color, "verdana.ttf", "Listeners: $currentlisteners"); imagepng ($im); imagedestroy ($im); ?>
header ("Content-type: image/png"); $im = ImageCreateFromPng("rj.png");
$song_conv = (iconv("utf-8","cp1252",$song [0]),3);
imagettftext ($im, 8, 0, 20, 30, $color, "verdana.ttf", "Song: $song[0]");
imagettftext ($im, 8, 0, 20, 30, $color, "verdana.ttf", "Song: $song_conv");
imagettftext ($im, 8, 0, 20, 15, $color, "verdana.ttf", "On AIR: " .$servertitle); imagettftext ($im, 8, 0, 20, 30, $color, "verdana.ttf", "Song: " .$song_conv); imagettftext ($im, 8, 0, 20, 45, $color, "verdana.ttf", "Listeners: " .$currentlisteners);
$song_conv = (iconv("utf-8","cp1252",$song[0]),3);
RewriteEngine on rewriterule index.png index.php