How often can I run a GET method on a URL

Soldato
Joined
18 Oct 2002
Posts
10,034
My PHP and Javascript knowledge are not 100% so I don't know the answer to this question.
I am trying to create a very simple radio player for a clients website. It only has to play a stream which he has a subscription to play his music from. I have achieved this pretty simply but getting the track name was a little more complicated.

I have found on Github a simple PHP function that lets you to extract the MP3 metadata (StreamTitle) from a streaming URL header response. So on page refresh, it happily dumps the track name out for me, but this obviously only works once.
I plan to use a bit of Javascript to return this function via an Ajax call and update the current playing track.
However if I would like this to change when the track does. I cannot at this time think of anyway to do this, except to keep looping this method every few seconds and updating the DOM.

What I don't know is, is this acceptable. Will the server suffer from continuously running an Ajax call every 5s or so and will the stream URL allow me to do this constantly.
I am assuming that it will be fine because the amount of data sent and received is very small.
I am a bit out of my depth here and it is a last ditch effort before I just create a link to radio stations external player.

Thanks
 
Soldato
Joined
23 Feb 2009
Posts
4,978
Location
South Wirral
From a load viewpoint, once every 5 seconds should be fine. Even a mickey mouse prototype site on a developer machine ought to handle that, unless the code is a complete pile of poo.

Its worth checking the T&C section on the website though: there may well be a section relating to "excessive use". Public facing sites usually have some checks in place to avoid spam, denial of service attacks etc, but the thresholds vary.
 
Soldato
OP
Joined
18 Oct 2002
Posts
10,034
Yeah this was my biggest worry. I believe the ajax request being run every 5 seconds should be fine for the server, it's a really short function. I have actually made it and it works fine, it's quite a cool little feature.
If I email the company and they say no. I'm gona be gutted now.

Thing is, if you download the external player playlist.pls it only contains the url and a few other bits. iTunes etc gets the Track names somehow so they must be doing some sort of polling to be able to get the track names.

What method can achieve getting the names at the right time?
 
Last edited:
Soldato
Joined
23 Feb 2009
Posts
4,978
Location
South Wirral
I'd be tempted to just adopt the google approach of not asking and seeking forgiveness afterwards :) Test for a couple of days with a demo account from a separate IP address (so as to not screw up your clients' account or access) and see if you get cut off.
 
Soldato
OP
Joined
18 Oct 2002
Posts
10,034
Well they replied and said it's fine. Now the hard work begins.. I was hoping to make WordPress pages ajaxified and have a persistent header with the player in it that never stops when you move between pages, I think there's a chance this is not gona work with all the other plugins and js library's I use.
 
Last edited:
Back
Top Bottom