I am writing a web page for an online radio station that uses SHOUTcast 1.9.8. I am trying to retrieve the currently playing song from the server, display it on the page, and keep it updated. I am looking for the best way to do this. I can get the current song from the SHOUTcast server's "7.html". The "7.html" looks like this "1,1,12,50,1,128,Artist - Song name". All I care about is the last thing, the artist and song name. I already know how to parse the string to get what I want in both PHP and Javascript. What I need is a way to retrieve the string from the server, so I can parse it and get it onto the webpage. I also need to keep the page updated with the currently playing song. I have done research but I haven't had much luck. What is the best way to do this? PHP? Javascript? I am fairly new to web development, I have little PHP and Javascript experience. Any help would be greatly appreciated.

Re: Best way to keep text on a page updated 80 80

If you want to keep the player playing while users navigating the site you'll need to resort to AJAX or even better to the HTML5 History API (with AJAX hashbanging as fallback).

Re: Best way to keep text on a page updated 80 80

I was able to figure it out on my own. What I did was write a PHP script that reterives the data from the "7.html" and parses the down to just what I need (the current song). Then, in a javascript script, I use a ajax request to get the parsed string from the PHP script and update the page. I also used setInterval so that it updates the page every 60 seconds.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.