|
|
#1 |
|
Registered User
|
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? |
|
|
|
|
|
#2 |
|
Senior Member
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 |
|
|
|
|
|
#3 |
|
Registered User
|
kewl, ty so much, so I can basically stick this script anyway in my html, k, ty
|
|
|
|
|
|
#4 |
|
Senior Member
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.
|
|
|
|
|
|
#5 |
|
Registered User
|
k, I understand now, duh hehe ty again
|
|
|
|
|
|
#6 |
|
Registered User
|
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
|
|
|
|
|
|
#7 |
|
Senior Member
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 |
|
|
|
|
|
#8 |
|
Registered User
|
<?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? |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Dec 2001
Posts: 240
|
Yes upload the PHP file to where your main site is.
soulful1 |
|
|
|
|
|
#10 |
|
Registered User
|
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?
|
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Dec 2001
Posts: 240
|
It should if the PHP file is configured properly.
soulful1 |
|
|
|
|
|
#12 |
|
Registered User
|
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?
|
|
|
|
|
|
#13 |
|
Forum Queen
|
heather, IM me and I'll help you with this if you would like it fixed sooner.
yeah, i'm back. |
|
|
|
|
|
#14 |
|
Registered User
|
k
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|