Go Back   Winamp Forums > SHOUTcast > SHOUTcast Discussions

Reply
Thread Tools Search this Thread Display Modes
Old 24th October 2004, 23:09   #1
HeatherS78
Registered User
 
HeatherS78's Avatar
 
Join Date: Oct 2004
Location: Kansas City,Missouri
Posts: 234
Send a message via Yahoo to HeatherS78
k, I have a ?

This code right here, I put my info in it, where do I stick this code at? on the same page of the site or on a seperate page?

this code:

<?php
$scdef = "xxxx";
$scip = "xx.xxx.xxx.xxx";
$scport = "xxxx";
$scpass = "xxxx";

$scfp = @fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo 'xxxx is Offline';
exit();
}
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);
}

//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

//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'<b>Current Song:</b><br>'.$song[0].'<br><b>Current Listeners: </b>'.$currentlisteners.' / 32';
exit();
}
?>


After I am done putting my info intot his code, where do I put this code at in my html?, for some reason I want to say in the <body></body> area, am I wrong? and or do I need a seperate page to put this code in, a page that supports php script?
HeatherS78 is offline   Reply With Quote
Old 24th October 2004, 23:40   #2
soulful1
Senior Member
 
soulful1's Avatar
 
Join Date: Dec 2001
Posts: 240
Save that file as a PHP file (example....currently_playing.php) and upload it to you server. Place this line in your html where you want the script to run <?php include ("currently_playing.php"); ?>

Good luck.

soulful1
soulful1 is offline   Reply With Quote
Old 24th October 2004, 23:42   #3
HeatherS78
Registered User
 
HeatherS78's Avatar
 
Join Date: Oct 2004
Location: Kansas City,Missouri
Posts: 234
Send a message via Yahoo to HeatherS78
kewl, ty so much, so I can basically stick this script anyway in my html, k, ty
HeatherS78 is offline   Reply With Quote
Old 24th October 2004, 23:47   #4
soulful1
Senior Member
 
soulful1's Avatar
 
Join Date: Dec 2001
Posts: 240
No. You can place the line <?php include ("currently_playing.php"); ?> anywhere in your html. The script should be saved as a PHP file and uploaded to your web server.
soulful1 is offline   Reply With Quote
Old 24th October 2004, 23:50   #5
HeatherS78
Registered User
 
HeatherS78's Avatar
 
Join Date: Oct 2004
Location: Kansas City,Missouri
Posts: 234
Send a message via Yahoo to HeatherS78
k, I understand now, duh hehe ty again
HeatherS78 is offline   Reply With Quote
Old 24th October 2004, 23:55   #6
HeatherS78
Registered User
 
HeatherS78's Avatar
 
Join Date: Oct 2004
Location: Kansas City,Missouri
Posts: 234
Send a message via Yahoo to HeatherS78
so this <?php include ("currently_playing.php"); ?> anywhere I want it to show on my site oke doke, ya can tell I don't know much of php like others lol
HeatherS78 is offline   Reply With Quote
Old 25th October 2004, 00:04   #7
soulful1
Senior Member
 
soulful1's Avatar
 
Join Date: Dec 2001
Posts: 240
Also make sure you give the page that you are placing the <?php include ("currently_playing.php"); ?> line a php extention. For example if the page is now called index.html, it should be changed to index.php

soulful1
soulful1 is offline   Reply With Quote
Old 25th October 2004, 00:16   #8
HeatherS78
Registered User
 
HeatherS78's Avatar
 
Join Date: Oct 2004
Location: Kansas City,Missouri
Posts: 234
Send a message via Yahoo to HeatherS78
<?php include ("currently_playing.php"); ?> this on the site itself

so the code I save as currently_playing.php, do I stick this on my webserver where my main site is going to be be at?, when you say upload it to my webserver, does that mean to the same site server or on a different site server put making it a php extension to it?
HeatherS78 is offline   Reply With Quote
Old 25th October 2004, 00:34   #9
soulful1
Senior Member
 
soulful1's Avatar
 
Join Date: Dec 2001
Posts: 240
Yes upload the PHP file to where your main site is.

soulful1
soulful1 is offline   Reply With Quote
Old 25th October 2004, 00:42   #10
HeatherS78
Registered User
 
HeatherS78's Avatar
 
Join Date: Oct 2004
Location: Kansas City,Missouri
Posts: 234
Send a message via Yahoo to HeatherS78
K, when I put <?php include ("currently_playing.php"); ?> on the site where I want it, will it show what song is playing now on my site? or do I need a code for that?
HeatherS78 is offline   Reply With Quote
Old 25th October 2004, 00:48   #11
soulful1
Senior Member
 
soulful1's Avatar
 
Join Date: Dec 2001
Posts: 240
It should if the PHP file is configured properly.

soulful1
soulful1 is offline   Reply With Quote
Old 25th October 2004, 00:54   #12
HeatherS78
Registered User
 
HeatherS78's Avatar
 
Join Date: Oct 2004
Location: Kansas City,Missouri
Posts: 234
Send a message via Yahoo to HeatherS78
if this PHP file is configured properly?, k, can you look at the script and tell me what to change and what NOT to change?
HeatherS78 is offline   Reply With Quote
Old 25th October 2004, 01:08   #13
protegechris
Forum Queen
 
protegechris's Avatar
 
Join Date: Feb 2004
Location: Texarkana, Texas/Arkansas
Posts: 6,635
Send a message via AIM to protegechris Send a message via Yahoo to protegechris
heather, IM me and I'll help you with this if you would like it fixed sooner.

yeah, i'm back.
protegechris is offline   Reply With Quote
Old 25th October 2004, 01:40   #14
HeatherS78
Registered User
 
HeatherS78's Avatar
 
Join Date: Oct 2004
Location: Kansas City,Missouri
Posts: 234
Send a message via Yahoo to HeatherS78
k
HeatherS78 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > SHOUTcast > SHOUTcast Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump