Go Back   Winamp Forums > SHOUTcast > SHOUTcast Discussions

 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 24th October 2004, 23:09   #1
HeatherS78
Registered User
 
HeatherS78's Avatar
 
Join Date: Oct 2004
Location: Kansas City,Missouri
Posts: 234
Send a message via Yahoo to HeatherS78
k, I have a ?

This code right here, I put my info in it, where do I stick this code at? on the same page of the site or on a seperate page?

this code:

<?php
$scdef = "xxxx";
$scip = "xx.xxx.xxx.xxx";
$scport = "xxxx";
$scpass = "xxxx";

$scfp = @fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo 'xxxx is Offline';
exit();
}
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);
}

//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS");
$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

//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);
}

//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'<b>Current Song:</b><br>'.$song[0].'<br><b>Current Listeners: </b>'.$currentlisteners.' / 32';
exit();
}
?>


After I am done putting my info intot his code, where do I put this code at in my html?, for some reason I want to say in the <body></body> area, am I wrong? and or do I need a seperate page to put this code in, a page that supports php script?
HeatherS78 is offline   Reply With Quote
 
Go Back   Winamp Forums > SHOUTcast > SHOUTcast Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump