<?php header ("Content-type: image/png"); $im = ImageCreateFromPng("blank.png"); $color = imagecolorallocate ($im, 255, 255, 255); $file_name='http://wasteland.spb.su:8080/status2.xsl'; $r=fopen($file_name,'r'); $text=fread($r,1000); fclose($r); $mass=explode(",", $text); $current="track".$mass [16]; $font="ft.ttf"; //имя шрифта $raz=100; //длина до обрезки $mr=imagettfbbox (6,0, $font, $current); $pr=$mr[2]; $ds=strlen($current); while ($pr >= $raz) { $current1=substr($current,0,$ds); $mr=imagettfbbox (6,0, $font, $current1); $pr=$mr[2]; $ds=$ds-1; } if ($ds!=strlen($current)) {$currentr=$current1."...";} imagettftext ($im, 6, 0, 15, 20, $color, $font,$current); imagepng ($im); imagedestroy ($im); ?>
<?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); ?>