PDA

View Full Version : Getting SHOUTcast stats with just IP & Port?



Moh
31-08-2008, 12:30 PM
Does anyone have the code to do this?
+rep :)

Jamieb
31-08-2008, 12:32 PM
Hello Jack!

Saw a script some were on the net that only needed IP and port about a week ago.

Ill hvae a look for it next time im on my pc i might of downloaded it..


Thanks Jamieb

Moh
31-08-2008, 12:39 PM
Hello Jack!

Saw a script some were on the net that only needed IP and port about a week ago.

Ill hvae a look for it next time im on my pc i might of downloaded it..


Thanks Jamieb
Ok, thanks :)

Calon
31-08-2008, 01:38 PM
<?php
// Mysql staus image script by Anthony Parkes
// [email protected]
// www.aj-services.com


$server = ""; // IP address to your shoutcast server.
$port = ""; // port of your shoutcast server
$online = ""; // Online Gif image
$offline = ""; // offline gif image




// Start Data Collection
$fp = fsockopen("$server", $port, $errno, $errstr, 30);
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n");
while (!feof($fp)) {
$content .= fgets($fp,128);
}
fclose($fp);
// start data processing
$debut = strpos($content, '<body>') + strlen('<body>');
$fin = strpos($content, '</body>', $debut);
$string = substr($content, $debut, $fin - $debut);
$stats = explode(',', $string);

// Start Image generation
// Dedug Status echo "$stats[1]";
//offline
if ($stats[1] == "0") {
header("Content-type: image/gif");
readfile('$offline');
}

//online
if ($stats[1] == "1") {
header("Content-type: image/gif");
readfile('$online');
}

?>

[http://www.habboring.com/scripts/SHOUTcast%20Image%20Stats.zip]

Moh
31-08-2008, 02:00 PM
<?php
// Mysql staus image script by Anthony Parkes
// [email protected]
// www.aj-services.com


$server = ""; // IP address to your shoutcast server.
$port = ""; // port of your shoutcast server
$online = ""; // Online Gif image
$offline = ""; // offline gif image




// Start Data Collection
$fp = fsockopen("$server", $port, $errno, $errstr, 30);
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n");
while (!feof($fp)) {
$content .= fgets($fp,128);
}
fclose($fp);
// start data processing
$debut = strpos($content, '<body>') + strlen('<body>');
$fin = strpos($content, '</body>', $debut);
$string = substr($content, $debut, $fin - $debut);
$stats = explode(',', $string);

// Start Image generation
// Dedug Status echo "$stats[1]";
//offline
if ($stats[1] == "0") {
header("Content-type: image/gif");
readfile('$offline');
}

//online
if ($stats[1] == "1") {
header("Content-type: image/gif");
readfile('$online');
}

?>
[http://www.habboring.com/scripts/SHOUTcast%20Image%20Stats.zip] (http://www.habboring.com/scripts/SHOUTcast%20Image%20Stats.zip%5D)
Ok, I have edited it to display the actual stats. I'm having trouble displaying the current radio dj.

echo("HabbCrazy is Online<br>Listeners: $stats[0] ($stats[4] unique)<br>Radio DJ: $stats[help]<br>Current Song: $stats[6]");

Do you know which number is stream title?

Stepheen
31-08-2008, 02:37 PM
The Housekeeping Guy has a radio spy which uses just the ip and port. Check that out :)

Moh
31-08-2008, 02:41 PM
The Housekeeping Guy has a radio spy which uses just the ip and port. Check that out :)
it took ages to load for me :(

Sadly, this script dosn't get the stream title, but im sure it can be added?

$stats[0] = Listeners
$stats[1] = Status
$stats[2] = Peak
$stats[3] = Max Listeners
$stats[4] = Unique Listeners
$stats[5] = Bitrate
$stats[6] = Song

So it has everything but stream title :S

RYANNNNN
31-08-2008, 04:22 PM
Why does everyone use explode and stuff to get data from a page?????????????????????????????????????????????? ?????????????????????

Moh
31-08-2008, 05:02 PM
Why does everyone use explode and stuff to get data from a page?????????????????????????????????????????????? ?????????????????????
Because all you have to do is explode this:
http://habbcrazy.net:8002/7.html

iUnknown
31-08-2008, 09:20 PM
it took ages to load for me :(

Sadly, this script dosn't get the stream title, but im sure it can be added?

$stats[0] = Listeners
$stats[1] = Status
$stats[2] = Peak
$stats[3] = Max Listeners
$stats[4] = Unique Listeners
$stats[5] = Bitrate
$stats[6] = Song

So it has everything but stream title :S

The Housekeeping Guy script uses that script so it was probably just a host or something that made it load slowly, or a SHOUTcast it tried to connect to that was down. Just copy the script, it has stream title.

Moh
01-09-2008, 10:55 AM
The Housekeeping Guy script uses that script so it was probably just a host or something that made it load slowly, or a SHOUTcast it tried to connect to that was down. Just copy the script, it has stream title.
The reason it wasnt' fetching the stream title is because it was getting the information from http://habbcrazy.net:8002/7.html.

So then I had to attack Simon on msn with code, and he came up with a solution :)



$fp = fsockopen("$server", $port, $errno, $errstr, 30);
fputs($fp, "GET /index.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n");
while (!feof($fp)) {
$content_title .= fgets($fp,1000);
}
fclose($fp);

$title = explode('<font class=default>Stream Title: </font>', $content_title);
$title = explode('</tr>', $title[1]);
$title = explode('<font class=default><b>', $title[0]);
$title = explode('</b>', $title[1]);
$title = $title[0];

Want to hide these adverts? Register an account for free!