|
|
#1 |
|
Registered User
|
Shoutcast code is showing Error
On my website if my stream is offline it hsows this:
Warning: fsockopen(): unable to connect to Hitz106.Servemp3.com:9020 in /home/****/public_html/index.php on line 79 Hitz106.com - #1 FOR HIP-HOP R&B is Offline I would prefer if it would only show something like Hitz106.com Is Currently Offline or Hitz106.com Servers are offline please help |
|
|
|
|
|
#2 |
|
Major Dude
|
Wouldn't be difficult to modify that with a little knowledge of PHP, if you can't do it yourself, post your stats script.
Words are very unnecessary, they can only do harm, so enjoy the silence - Depeche Mode Firemonger Project: Help spread Firefox |
|
|
|
|
|
#3 |
|
Registered User
|
hey umm it is this
//Configuration $scdef = "Hitz106.com - #1 FOR HIP-HOP R&B";// Default station name to display when server or stream is down $scip = "**************"; // ip or url of shoutcast server $scport = "9020";// port of shoutcast server $scpass = "***********"; // password to shoutcast server //End configuration |
|
|
|
|
|
#4 |
|
Major Dude
|
No, that's variables used for the script not code part that you have to modify.
Words are very unnecessary, they can only do harm, so enjoy the silence - Depeche Mode Firemonger Project: Help spread Firefox |
|
|
|
|
|
#5 |
|
Registered User
|
Well hey here is the one from my website Index.php can u please edit is so when my servers are not online it will say Hitz106.com is currently offline or Hitz106.com - #1 FOR HIP-HOP R&B. Also do you think you could by any change add an Iframe so the current song will update and not the whole page?
<?php // Shoutcast Server Stats // Parses shoutcasts xml to make an effective stats thing for any website // hardcore coded by daniel brown aka xbrowniex ©www.gmtt.co.uk 2003. include('config_radio.php'); //you may edit this path to fit your server environment otherwise leave it alone $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"); $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="30;URL=radio_stats.php"> <link rel=stylesheet href="" type="text/css"> <title>'.$scdef.'</title> </head> <body text="" bgcolor=""> <p align="center"><center> <font face="arial" size="2"><b> Server Name:</b> '.$servertitle.'</font></p> <font face="arial" size="2"><b> Listeners:</b> '.$currentlisteners.' / 10</font></p> <font face="arial" size="2" color=""><b> Current Song:</b> '.$song[0].'</font></p> <b> <font face="arial" size="2"> Past Songs:</font></b> <font color=""><font face="arial" size="2"> <p align="center"> <b>1.</b> '.$song[1].'<BR> <b>2.</b> '.$song[2].'<BR> <b>3.</b> '.$song[3].'<BR> <b>4.</b> '.$song[4].'<BR> <b>5.</b> '.$song[5].'<BR> </font> <BR> </p></p> </body> </html>'; } ?> |
|
|
|
|
|
#6 |
|
Major Dude
|
Just find the first excutable line and add a '@' in front of it:
@$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30); This will prevent the warning to appear when the DNAS is down. Just one thing, that script doesn't show anything if the DNAS is running but there's no stream. To fix that, add the line below to the last part of the code, just after the last '}' and before the PHP closing tag '?>': elseif($scsuccs!=1) { echo "Server is up but no stream is available"; } Besides, the script's author forgot to add // stolen from casterclub's sc_song script ![]() I didn't understand what you mean by updating just the current song, loading the script on an iframe inside your homepage for example, will refresh just the content of the frame [ie: current and played songs] without reloading the main page. Words are very unnecessary, they can only do harm, so enjoy the silence - Depeche Mode Firemonger Project: Help spread Firefox |
|
|
|
|
|
#7 |
|
Registered User
|
how do I put it in an iframe so it only update the song n' not the whole page
can u put it in one for me? |
|
|
|
|
|
#8 |
|
Major Dude
|
That question was answered here.
Words are very unnecessary, they can only do harm, so enjoy the silence - Depeche Mode Firemonger Project: Help spread Firefox |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|