View previous topic :: View next topic |
Author |
Message |
Cyberian75
Joined: 26 Sep 2002 Posts: 1019 Location: Oregon
|
Posted: Mon Jan 26, 2004 1:12 am Post subject: SHOUTcast Status Script |
|
|
I thought I'd share...
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 |
|
 |
inthemusic
Joined: 17 Feb 2004 Posts: 1
|
Posted: Tue Feb 17, 2004 1:19 am Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1019 Location: Oregon
|
Posted: Sun May 02, 2004 1:54 am Post subject: |
|
|
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 |
|
 |
Nokrosis
Joined: 23 May 2004 Posts: 11
|
Posted: Sun May 23, 2004 9:22 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1019 Location: Oregon
|
Posted: Sun May 23, 2004 10:17 pm Post subject: |
|
|
Did you put your IP address??? How the Winamp plugin (server)? _________________ Michael P. |
|
Back to top |
|
 |
Nokrosis
Joined: 23 May 2004 Posts: 11
|
Posted: Sun May 23, 2004 10:55 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1019 Location: Oregon
|
Posted: Sun May 23, 2004 11:01 pm Post subject: |
|
|
Is it where you're running the Winamp server??? If so, try setting the relay option off. _________________ Michael P. |
|
Back to top |
|
 |
Nokrosis
Joined: 23 May 2004 Posts: 11
|
Posted: Sun May 23, 2004 11:17 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1019 Location: Oregon
|
Posted: Mon May 24, 2004 12:36 am Post subject: |
|
|
Could I see how you're calling the function??? _________________ Michael P. |
|
Back to top |
|
 |
Nokrosis
Joined: 23 May 2004 Posts: 11
|
Posted: Mon May 24, 2004 10:55 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1019 Location: Oregon
|
Posted: Mon May 24, 2004 11:31 pm Post subject: |
|
|
You've modified the funtion itself. Use the original function with "$ip=0.0.0.0". _________________ Michael P. |
|
Back to top |
|
 |
Nokrosis
Joined: 23 May 2004 Posts: 11
|
Posted: Mon May 24, 2004 11:41 pm Post subject: |
|
|
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 |
|
 |
Nokrosis
Joined: 23 May 2004 Posts: 11
|
Posted: Mon May 24, 2004 11:46 pm Post subject: |
|
|
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 |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1019 Location: Oregon
|
Posted: Mon May 24, 2004 11:50 pm Post subject: |
|
|
Try using a real IP then... _________________ Michael P. |
|
Back to top |
|
 |
Nokrosis
Joined: 23 May 2004 Posts: 11
|
Posted: Mon May 24, 2004 11:58 pm Post subject: |
|
|
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 |
|
 |
|