How to put a piece of dynamic php code in a static web page?

Jay

New member
Okay i little more detail, What i Have is an internet radio station using a simple php script that displays the current playing song. But i have a problem, when a user goes onto the Web page it says the song but when the song changes the script still displays song that was playing when the user first started listening.
Would it be possible to make just that php code refresh automatically because if i set the whole web page to auto refresh then the player refreshes as well.
The codes underneath if anyone could help please do.

<?php
/*Version: v1.1*/
/* ----------- Server configuration ---------- */

$ip = "jaynethits.homeip.net";
$port = "2010";

/*Start */
$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp)
{
echo "Off Air!"; // Diaplays when sever is offline
}
else
{
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
while (!feof($fp))
{
$info = fgets($fp);
}
$info = str_replace('</body></html>', "", $info);
$split = explode(',', $info);
if (empty($split[6]) )
{
echo "There Seems To Be No Song Playing."; // Diaplays when sever is online but no song title
}
else
{
$title = str_replace('\'', '`', $split[6]);
$title = str_replace(',', ' ', $title);
echo "$title"; // Diaplays song
}
}
?>


P.S if it helps i stream my music using shoutcast.


Thanks Jay.
 
Back
Top