• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Script with Cronjob and PHP output...how to?

Dear all,

I am breaking my head over the following little thing I want to do. I am running a web-radio. (Harddance music, url on request!) and I want to show the current song playing.

There are various scripts do do so, but all require a call to the shout-cast server which creates a considerable delay in opening any page; I want this now playing on each page.

So I had the idea to make a script which reads the data from the shout-cast scheduled by a cron, writes a text file to the web server, I include the .txt file in the site. Cron runs every 2min.

Now I just about know as much of coding as the average person knows about enriching plutonium. So since I won't be getting this script realized any time soon, does someone have an alternative to my un-executable idea's?

I have a lot of shoutcast now playing scipts, but all are creating tremendous delays.

Here is the example scipt:

<div style="Visibility: Hidden; Position: Absolute;">
$open = fsockopen("192.mp3.streams.lsw.evo.hard.fm","8000");
if ($open) {
fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
$read = fread($open,1000);
$text = explode("content-type:text/html",$read);
$text = explode(",",$text[1]);
} else { $er="Connection Refused!"; }
if ($text[1]==1) { $state = "Up"; } else { $state = "Down"; }
if ($er) { echo $er; exit; }
echo "<font face=verdana size=1>
Listeners: $text[0] of $text[3] ($text[4] Unique)<br>
Listener Peak: $text[2]<br>
Server State: <b>$state</b><br>
Bitrate: $text[5] Kbps<br>
Current Song: $text[6]
Anyone able to help me? :)