PDA

View Full Version : Question about a Streamsolutions script..


Diablosblizz
1st December 2006, 21:56
EDIT: I relised that I had 3 php codes, so I cut down to one..and it still doesn't work, I get a blank page:


<?php

// Fill in your own server information here:
$customer_server = "24.141.133.213";
$customer_port = "8000";
$variable = "stream_title";

// variable can be one of the following

// version
// server_status
// stream_status
// listener_peak
// average_listen_time
// stream_title
// content_type
// stream_genre
// stream_url
// stream_aim
// stream_irc
// current_song
// server_bitrate
// server_current_listeners
// server_listen_link
$page="";
// do not change anything below here.

$host = "statistics.streamsolutions.co.uk";
$port = "80";
$stats_get_line="GET http://$host/shoutcast/text/index.php?";
$stats_get_line.="server=$customer_server&port=$customer_port&variable=$variable

HTTP/1.0\r\n";
$stats_get_line.="User-Agent: StreamSolutions (Mozilla Compatible)\r\n\r\n";
$fp = fsockopen("$host", $port, &$errno, &$errstr, 30); //open connection
fputs($fp,$stats_get_line);
while(!feof($fp)) {
$page .= fgets($fp, 1000);
}
fclose($fp);
$lines=split("\n",$page);
print $lines[8];
?>


Thanks.

Nick@ss
2nd December 2006, 07:55
This script is from the section that says Streamsolutions Servers Only

we offer these scripts to our clients of our that have fsock issues with their webhosts.

if its not an ss server it wont work.

there are other scripts on that page for people to use for non ss servers.

xhilaration
2nd December 2006, 12:10
*NOT BASHING* Just saying here, hun you don't even have a website up YET, I go to your (www) link and it says your domain is registered but there is no page.

Are you still building your site? just wondering.

Diablosblizz
2nd December 2006, 15:16
@nick@ss:
Do you have a Shoutcast script that gets the current DJ? Or do you know how to get the current DJ's name (or whats under description in the shoutcast dps source)? I am 100% sure this is possible, I had this working before and now I forget :S


@xhilaration:
Yes, I am still buiding my site..and how do you know what my site is? I am only testing my site on my apache server..soo..

Nick@ss
2nd December 2006, 17:38
whatever is on the site is whats currently available.

Diablosblizz
2nd December 2006, 18:11
Well there was one script but it didn't work.. ugh..

Nick@ss
2nd December 2006, 18:36
The scripts all work as the demos show but i imagine its your webhost thats the problem not allowing the port.

this is why we created the port 80 scripts for our clients as some webhosts can be a real pain to install on.

try asking your webhost to help you out.

Diablosblizz
2nd December 2006, 19:35
Okay here I go:

Hi Diablosblizz I'm having troubles with your host.

Im running my apache server on port 80 and my radio server on port 8000 and wwwinamp on 800..

Ports ports ports!

Okay I am trying to get this one to work.

http://www.streamsolutions.co.uk/scripts/phpscript/radio_stats.php

All I need from that is well the stream title.. I already have a working script from SS and its fine, but it doesn't include the stream title..

Any other ideas?

xhilaration
3rd December 2006, 14:24
Originally posted by Diablosblizz
@nick@ss:
Do you have a Shoutcast script that gets the current DJ? Or do you know how to get the current DJ's name (or whats under description in the shoutcast dps source)? I am 100% sure this is possible, I had this working before and now I forget :S


@xhilaration:
Yes, I am still buiding my site..and how do you know what my site is? I am only testing my site on my apache server..soo..

I clicked on the WWW button below your posts lol and when I go to your www.habbo-insider.tk, it takes me here:
http://my.dot.tk/registration/availability?domainname=habbo-insider.tk. Here's what the screen says:

HABBO-INSIDER.TK
This domain has already been registered

Feel free to visit the webpage of this registrant at http://www.habbo-insider.tk/. For more information about the current registrant, you can do a WHOIS lookup. All the domain names below are available. These are other names you might like.

You've registered your domain already but it is bring up that page and not your hoome page.

If you don't want people to see your site yet, then take your URL out of the www space in your control panel lol

It doesn't matter if you are using PHP for your server, its your URL that is not showing up lol. It takes me to the .tk domain page lol

xhilaration
3rd December 2006, 14:39
Originally posted by nick@ss
The scripts all work as the demos show but i imagine its your webhost thats the problem not allowing the port.

this is why we created the port 80 scripts for our clients as some webhosts can be a real pain to install on.

try asking your webhost to help you out.

OR, his hosting doesnt have PHP enabled. You might have to contact your webhosting and ask them if they can enable the php function.

Or your webhost doesn't have php and if thats the case you'll need to find a new hosting that has PHP.

But if your hosting does have PHP, here's what you need to do in the config of that script:
<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// ©2004-2005 Daniel Brown http://www.gmtt.co.uk
// Please refer to the readme file for use.


// Add-On MAXLISTNERS insead of the / 10 MAXLISTENERS which was set, and the BITRATE add-on.
// Online and Offline graphics, and add-on code.
// Better HTML Script.

// Do Not Try To Edit This Only Unless You Know What You're Doing!!!!!!!

include('config_radio.php');

$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", "MAXLISTENERS", "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 || $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 http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>

<body text="" bgcolor="">


<p align="center"><center>
<img src="online.jpg"><br>
<b>Stream Title:</b> '.$servertitle.'<br>
</p>
</body>

</html>';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>Radio Server Is Offline</title>
</head>

<body text="" bgcolor="">
<center>
<img src="offline.jpg">
</body>

</html>';
}
?>


Where you see this part:
<body text="" bgcolor="">


<p align="center"><center>
<img src="online.jpg"><br>
<b>Stream Title:</b> '.$servertitle.'<br>
<b>Listeners:</b> '.$currentlisteners.' / '.$maxlisteners.'<br>
<b>Bitrate:</b> '.$bitrate.'kbps<br>
<b>Current Song:</b> '.$song[0].'</p><b>
</p>
</body>

Just delete the Liteners,Bitrate & Current Song, unless you want Just the Current Song, then delete these Stream Title,Listeners & Bitrate. I hope that helps you some hun :)

Diablosblizz
3rd December 2006, 17:21
Ah, man I don't do that habbo crap anymore.. Wasted my time..and money..

im working on a site called Tha-Radio..

Maybe I should update my profile!

<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// ©2004-2005 Daniel Brown <a href="http://www.gmtt.co.uk" target="_blank">http://www.gmtt.co.uk</a>
// Please refer to the readme file for use.


// Add-On MAXLISTNERS insead of the / 10 MAXLISTENERS which was set, and the BITRATE add-on.
// Online and Offline graphics, and add-on code.
// Better HTML Script.

// Do Not Try To Edit This Only Unless You Know What You're Doing!!!!!!!

include('config_radio.php');

$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", "MAXLISTENERS", "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 || $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 http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>

<body text="" bgcolor="">


<p align="center"><center>
<img src="online.jpg"><br>
<b>Stream Title:</b> '.$servertitle.'<br>
</p>
</body>

</html>';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>Radio Server Is Offline</title>
</head>

<body text="" bgcolor="">
<center>
<img src="offline.jpg">
</body>

</html>';
}
?>


Where do I put this? config_radio.php or radio_stats.php?

I don't have any idea where to put this!