1
Notch
Shoutcast Block
  • 2005/11/18 1:10

  • Notch

  • Just popping in

  • Posts: 6

  • Since: 2005/11/16


I am trying to add a simple Shoutcast block.

I have tried using the Shoutc ast module but have found that if for whatever reason my Shoutcast server goes down the module locks up my home page and the only way to fix it is to deactivate the module. Thats a hassle.

I have gathered what appears to be a simple way to show my stats and songs via PHP. it requires two files:

sc_config.php
sc_song.php

I have tried using this with both files located in the XOOPS root and then created a PHP block with the following:

include ('./sc_song.php');

There is an include inside the sc_song.php file which calls the sc_config.php file.

All I get is a empty box and the block doesn't even show up on the home page.

So I tried adding the actual code of the sc_song.php into the block and I DO get the block to appear, but with the message "is Offline". I do know the server is online because I can pull up my Shoutcast stats page and actually go to Shoutcast and see my station listed.

So I guess what I am wondering is if the sc_config.php is being ignored which in turn would make the script unable to be granted access rights to the server.

I'm including both scripts here. If anyone can help I'd be greatly appreciative.

sc_config.php code:
<?php
//Configuration
$scdef "Missouri Music Radio";               // Default station name to display when server or stream is down
$scip "207.40.210.49"// ip or url of shoutcast server
$scport "8000";                   // port of shoutcast server
$scpass "xxxxxxx";                 // password to shoutcast server
//End configuration
?>


sc_song.php code:
//connect to shoutcast server
include('./config.php');  //you may edit this path to fit your server environment otherwise leave it alone
$scfp fsockopen("$scip"$scport, &$errno, &$errstr30);
 if(!
$scfp) {
  
$scsuccs=1;
echo
''.$scdef.' is Offline';
 }
if(
$scsuccs!=1){

  
//for newer shoutcast servers
fputs ($scfp"GET /admin.cgi?mode=viewxml HTTP/1.1rnHost: $scip:$scportrn .
User-Agent: SHOUTcast Song (author: dstjohn@mediacast1.com)(Mozilla Compatible)rn .
Authorization: Basic "
.base64_encode ("admin:$scpass")."rnrn");
 while(!
feof($scfp)) {
  
$page .= fgets($scfp1000);
 }

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


//format the date
$frmt_date[$t] = date('l dS of F Y h:i:s A',$playedat[$t]);
    
//you may edit the html below, make sure to keep variables intact
echo'
<b>'
.$t.'.</b>Song:  '.$song[$t].' - <b>Played @</b> '.$frmt_date[$t].'<BR>
'
;


        
$r++;
    }

fclose($scfp);
}

2
Notch
Re: Shoutcast Block
  • 2005/11/18 19:44

  • Notch

  • Just popping in

  • Posts: 6

  • Since: 2005/11/16


**BUMP**

Anyone???

3
Notch
Re: Shoutcast Block
  • 2005/11/21 20:17

  • Notch

  • Just popping in

  • Posts: 6

  • Since: 2005/11/16


No XOOPS staff looking at this with any idea?

4
pmcnamara
Re: Shoutcast Block
  • 2005/11/22 14:06

  • pmcnamara

  • Friend of XOOPS

  • Posts: 147

  • Since: 2004/12/3


I would be interested in this also.

5
Notch
Re: Shoutcast Block
  • 2005/11/25 0:34

  • Notch

  • Just popping in

  • Posts: 6

  • Since: 2005/11/16


**BUMP**

Someone...anyone...

Login

Who's Online

180 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 180


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits