Old 17th February 2008, 11:49   #1
BestMusicMix
Junior Member
 
Join Date: Sep 2007
Posts: 4
need help with a php script

hiya to be blunt im struggling with php i want a last 10 script but i cant seem to figure out how to put the info in to make it work i have tried everything but im no good with phps im a typical women not very technical minded i was wondering if anyone could help me please if i gave them my ip and port whether they could make it for me i know im asking alot but im at my wits end now
BestMusicMix is offline   Reply With Quote
Old 20th February 2008, 22:27   #2
geetee
Junior Member
 
Join Date: Oct 2007
Posts: 8
The simplest way:

http : // 111.222.333.444 : 5555 / played.html

Take the spaces out!

Replace with ur IP and port number of course

That page will show the last x number of tracks as defined in ur server config - often set to 10 - max of 20.

You can use PHP to pull the same information from the XML stats of the shoutcast and display it how you like. I hacked about with the SCXML scripts to make it do what I wanted - but never did a last 10 with it. It should be simple enough though.

I'm sure there's some standard scripts out there (on this site somewhere, I forget where!) that you just need to put the server IP, Port and Password in the relevant place to make work that will do what you want.

If you're still stuck I'm sure I could knock something together.

GeeTee

Last edited by geetee; 20th February 2008 at 23:14.
geetee is offline   Reply With Quote
Old 20th February 2008, 23:20   #3
LCR1610AM
Senior Member
 
Join Date: Oct 2007
Location: PNW (Langley,Wa) 40 m N from Seattle Wa.
Posts: 108
that woks and is a quick and dirty trick
but you have the ulgy black shoutcast server page
not very girly try the script from Stream Solutions..
it works for me you need to change some things
put this in the web directory where your website is



PHP Code:
<?php
//CONFIG
$scdef  =       "LCR 1610AM Music History"
                                            
// ABOVE: Default station name to display when server or stream is down
$scip   =       "the_ip_of_S.Cast_server";           // ip or url of shoutcast server (DO NOT ADD [url]HTTP://[/url] don't include the port)
$scport =       "8004";                     // port of shoutcast server
$scpass =       "shout_cast_password";              // password to shoutcast server

$refreshrate =  "15";                       // Script/Page refresh time
$bgcolor =      "#f8f5e5"// page background colour, hex value, default = white, #ffffff

//End configuration
//*********** DONE PUT YOUR INFO HERE ***********//

$scfp fsockopen("$scip"$scport, &$errno, &$errstr30);
 if(!
$scfp) {
  
$scsuccs=1;
echo
''.$scdef.' may need to be re loaded or 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($scfp1000);
 }
 
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//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
######################################################################################################################
######################################################################################################################
/////////////////////////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);
}

//display stats 
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'

<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="'
.$refreshrate.';URL=http://www.ur_ip.com/stream_stats.php">
<link href="main.css" type="text/css" rel="stylesheet" />
<title>'
.$scdef.'</title>
</head>
<! body text="" style="background-color:transparent">
<body bgcolor="#f8f5e5">
<center><b><font size="5"><! FONT COLOR="#000000">
Currently Playing:</b></font><font size="5"> '
.$song[0].'</font></br>
<br />
</center>
<span class="boldtype2"><font size="4"><b>Previous Tracks</span></font></b><br />
<li><span class="boldtype3">'
.$song[1].'</span></li>
<li><span class="boldtype3">'
.$song[2].'</span></li>
<li><span class="boldtype3">'
.$song[3].'</span></li>
<li><span class="boldtype3">'
.$song[4].'</span></li>
<li><span class="boldtype3">'
.$song[5].'</span></li>
<li><span class="boldtype3">'
.$song[6].'</span></li>
<li><span class="boldtype3">'
.$song[7].'</span></li>
<li><span class="boldtype3">'
.$song[8].'</span></li>
<li><span class="boldtype3">'
.$song[9].'</span></li>
<li><span class="boldtype3">'
.$song[10].'</span></li>
<li><span class="boldtype3">'
.$song[11].'</span></li>
<li><span class="boldtype3">'
.$song[12].'</span></li>
<li><span class="boldtype3">'
.$song[13].'</span></li>
<li><span class="boldtype3">'
.$song[14].'</span></li>
<li><span class="boldtype3">'
.$song[15].'</span></li>
<li><span class="boldtype3">'
.$song[16].'</span></li>
<li><span class="boldtype3">'
.$song[17].'</span></li>
<li><span class="boldtype3">'
.$song[18].'</span></li>
<li><span class="boldtype3">'
.$song[19].'</span></li>
</body>
</html>'
;

}
if(
$streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="'
.$refreshrate.';URL=http://www.urip.com/stream_stats.php">
<link href="main.css" type="text/css" rel="stylesheet" />
<title>Radio Server Is Offline</title>
</head>

<body text="" style="background-color:transparent">
<span class="playdisplay">Server Offline! :(</span>
</body>

</html>'
;
}
?>

LCR1610AM & KWPA 103.1 FM
Radio Tech
on ShoutCast search for (Local Radio & Music)
http://ww2.whidbey.net/lcr1610am

Most computer errors happen between the keyboard & the chair!
LCR1610AM is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

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