You are here: Re: Page refresh content « All PHP « IT news, forums, messages
Re: Page refresh content

Posted by Frits van Leeuwen on 10/11/26 11:57

"dirk van lierop" <d.vanlierop1@chello.nl> schreef in bericht
news:44ee$44ff0a48$3ec32fa9$26614@news.chello.nl...
> Hello All,
>
> I'm making a online web radio wich will auto refresh its song title and
> users. and what i want to do is to auto refresh an echo so when song
> changes it will change without refreshing the whole webpage.
>
> how can i do this? so just the echo of server status, stream status,
> listener peak and current song need to get auto updated.
>
> Thanks in advance,
>
> Dirk van Lierop d.vanlierop1@chello.nl
>
> ///////////////////////////////////////////////////////////////////////////////////////////
>
> Here is my code:
>
>
> <?php
>
> $config["host"] = "*****myip****";
> $config["port"] = "*****myport****";
>
>
>
> $strShoutCastResult = null;
> $blnServerStatus = false;
> $arrServerStatus = Array();
>
>
>
>
> function _DownloadFile()
> {
> global $config;
> $tmpStr = null;
>
> $fSock = @fsockopen($config["host"], $config["port"], $errno, $errstr,
> 5); /* Open Connection, Timeout 5 Seconds */
> if (!$fSock)
> {
> return false;
>
> }
> else
> {
> @fwrite($fSock,
> "GET /7.html HTTP/1.0\r\n" .
> "User-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"
> );
> while(!feof($fSock))
> {
> $tmpStr .= fgets($fSock, 1024);
> }
> }
> @fclose($fSock);
> return $tmpStr;
> }
>
>
> $strShoutCastResult = _DownloadFile();
>
> if(stristr($strShoutCastResult, "HTTP/1.0 200 OK") === FALSE)
> {
> $blnServerStatus = false;
> }
> else
> {
> $blnServerStatus = true;
> preg_match("/(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(.*)/",
> $strShoutCastResult, $arrServerStatus);
> array_shift($arrServerStatus);
> }
>
> /*
> [0] = Current Listeners
> [1] = Connected?
> [2] = Peak Listeners
> [3] = Max Listeners
> [4] = Reported Listeners
> [5] = kbps (Steam Rate)
> [6] = Song Playing
>
> Why is [0] Exactly The Same As [4] ? - We ll Just Use 4...
>
> */
>
> if ($blnServerStatus)
> {
> if ($arrServerStatus["1"] == "1")
> {
> echo "<b>Server Status:</b> Server is currently up and public.
> <br />";
> echo "<b>Stream Status:</b> Stream is up at ".
> $arrServerStatus["5"] ." kbps with ". $arrServerStatus["4"] ." of ".
> $arrServerStatus["3"] ." listeners. <br />";
> echo "<b>Listener Peak:</b> ". $arrServerStatus["2"] ." <br
> />";
> echo "<b>Current Song:</b> ". $arrServerStatus["6"] ."<br />";
> }
> else
> {
> echo "<b>Server Status:</b> Server is currently down.<br /><br
> />";
> }
> }
> else
> {
> echo "Server Is Offline! - Unable To Fetch Data/ParseData.";
> }
>
> // echo "<br /><br /><hr />". highlight_file(__FILE__, true);
>
>
> ?>
>
I think every song has a timelength. So I think you are looking for a
changing page after the song time.



--------------------------------------------------------------------------------
Mijn Postvak In wordt beschermd door SPAMfighter
4017 spam-mails zijn er tot op heden geblokkeerd.
Download de gratis SPAMfighter vandaag nog!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация