boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SHOUTcast Status Script
Goto page 1, 2  Next
 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
Cyberian75



Joined: 26 Sep 2002
Posts: 1019
Location: Oregon

PostPosted: Mon Jan 26, 2004 1:12 am    Post subject: SHOUTcast Status Script Reply with quote

I thought I'd share... Smile

Code:

<?php
function shoutcast($ip="0.0.0.0", $port=8000, $sec=1, $onair='Radio is on', $offair='Radio is off') {
   if ( $ip != "0.0.0.0" ) {
      $check = @fsockopen("$ip", $port, $errno, $errstr, $sec);
      
      if ($check) {
         echo $onair;
         fclose($check);
      } else {
         echo $offair;
      }
   }
}
?>


Call it with...

Code:

<?php shoutcast(ip, port, seconds, 'on-air messege/link', 'off-air message/link'); ?>



This script is provided as is and will not be supported.
_________________
Michael P.


Last edited by Cyberian75 on Tue May 25, 2004 2:24 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website AIM Address
inthemusic



Joined: 17 Feb 2004
Posts: 1

PostPosted: Tue Feb 17, 2004 1:19 am    Post subject: Reply with quote

im sorry but im new with php and im not sure how to use it, could you help me? also i was wondering if there were any other codes you could share that give more info about the shoutcast servers

i.e. current song, how many listeners, etc
Back to top
View user's profile Send private message Visit poster's website AIM Address
Cyberian75



Joined: 26 Sep 2002
Posts: 1019
Location: Oregon

PostPosted: Sun May 02, 2004 1:54 am    Post subject: Reply with quote

I believe those features are built into its server software. As for this script, follow this syntax:

Code:

<?php shoutcast(192.168.1.1, 8080, 5, 'on-air messege/link', 'off-air message/link'); ?>



Sorry for the delay by the way.
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Nokrosis



Joined: 23 May 2004
Posts: 11

PostPosted: Sun May 23, 2004 9:22 pm    Post subject: Reply with quote

I can't get your script to work, it only returns the offline message, even when i'm streaming.
is anything wrong???
Back to top
View user's profile Send private message
Cyberian75



Joined: 26 Sep 2002
Posts: 1019
Location: Oregon

PostPosted: Sun May 23, 2004 10:17 pm    Post subject: Reply with quote

Did you put your IP address??? How the Winamp plugin (server)?
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Nokrosis



Joined: 23 May 2004
Posts: 11

PostPosted: Sun May 23, 2004 10:55 pm    Post subject: Reply with quote

I'm using "rs4.radiostreamer.com".

do i have to put the exact IP adress??

i traced the rs4.radiostreamer.com IP address and used it too, but it only returns the offline message it never shows the online one when i'm streaming.
Back to top
View user's profile Send private message
Cyberian75



Joined: 26 Sep 2002
Posts: 1019
Location: Oregon

PostPosted: Sun May 23, 2004 11:01 pm    Post subject: Reply with quote

Is it where you're running the Winamp server??? If so, try setting the relay option off.
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Nokrosis



Joined: 23 May 2004
Posts: 11

PostPosted: Sun May 23, 2004 11:17 pm    Post subject: Reply with quote

Ok, i turned the allow relay and allow public relay options off, but it keeps sending me the offline message, in any case (streaming and not streaming)
Back to top
View user's profile Send private message
Cyberian75



Joined: 26 Sep 2002
Posts: 1019
Location: Oregon

PostPosted: Mon May 24, 2004 12:36 am    Post subject: Reply with quote

Could I see how you're calling the function???
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Nokrosis



Joined: 23 May 2004
Posts: 11

PostPosted: Mon May 24, 2004 10:55 pm    Post subject: Reply with quote

this is it, please correct me if i'm wrong:

Code:
<?php
function shoutcast($ip="rs4.radiostreamer.com", $port=8820, $sec=1, $onair='Radio is on', $offair='Radio is off') {
   if ( $ip != "rs4.radiostreamer.com" ) {
      $check = @fsockopen("$ip", $port, $errno, $errstr, $sec);
     
      if ($check) {
         echo $onair;
         fclose($check);
      } else {
         echo $offair;
      }
   }
}
?>



<html>
<body>
<?php shoutcast(rs4.radiostreamer.com, 8820, 1, 'on-air messege/link', 'off-air message/link'); ?>
</body>


</html>
Back to top
View user's profile Send private message
Cyberian75



Joined: 26 Sep 2002
Posts: 1019
Location: Oregon

PostPosted: Mon May 24, 2004 11:31 pm    Post subject: Reply with quote

You've modified the funtion itself. Use the original function with "$ip=0.0.0.0".
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Nokrosis



Joined: 23 May 2004
Posts: 11

PostPosted: Mon May 24, 2004 11:41 pm    Post subject: Reply with quote

so, the only thing i had to modify on the function was the port???

or just anything??

the only thing i had to change was the funcion call?
Back to top
View user's profile Send private message
Nokrosis



Joined: 23 May 2004
Posts: 11

PostPosted: Mon May 24, 2004 11:46 pm    Post subject: Reply with quote

Ok, i've got this:



Code:

<?php
function shoutcast($ip="0.0.0.0", $port=8000, $sec=1, $onair='Radio is on', $offair='Radio is off') {
   if ( $ip != "0.0.0.0" ) {
      $check = @fsockopen("$ip", $port, $errno, $errstr, $sec);
     
      if ($check) {
         echo $onair;
         fclose($check);
      } else {
         echo $offair;
      }
   }
}
?>



<html>
<body>


<?php shoutcast(rs4.radiostreamer.com, 8820, 5, 'on-air messege/link', 'off-air message/link'); ?>

</body>
</html>




But it keeps sending me only the offline message although i'm streaming.
Back to top
View user's profile Send private message
Cyberian75



Joined: 26 Sep 2002
Posts: 1019
Location: Oregon

PostPosted: Mon May 24, 2004 11:50 pm    Post subject: Reply with quote

Try using a real IP then...
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Nokrosis



Joined: 23 May 2004
Posts: 11

PostPosted: Mon May 24, 2004 11:58 pm    Post subject: Reply with quote

MMm, file is like this:

Code:
<?php
function shoutcast($ip="0.0.0.0", $port=8000, $sec=1, $onair='Radio is on', $offair='Radio is off') {
   if ( $ip != "0.0.0.0" ) {
      $check = @fsockopen("$ip", $port, $errno, $errstr, $sec);
     
      if ($check) {
         echo $onair;
         fclose($check);
      } else {
         echo $offair;
      }
   }
}
?>



<html>
<body>


<?php shoutcast(216.218.254.98, 8820, 5, 'on-air messege/link', 'off-air message/link'); ?>

</body>
</html>



But...

Parse error: parse error in /home/nokrosis/public_html/radio/prueba/index.php on line 22
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group