Reputation: 4083
Hi I'm doing a website which contains several radios. I need to know, through javascript, if a radio stream url is working or not. I achieve this in PHP doing a file_get_contents($radio_source, false, NULL, -1, 600);
, doing this I know that if the request reached the limit (600) then the request is alive, otherwise, not. My question is: Does exist a way to do this in Javascript?. So far, $.ajax doesn't seems to be an option, because doesn't have any parameter to help me to achieve this.
Upvotes: 0
Views: 714
Reputation:
You can use this cool function built for javascript: https://github.com/kvz/phpjs/blob/master/functions/filesystem/file_get_contents.js . That uses XMLHttpRequest
Upvotes: 2
Reputation: 6058
You could have the same code that you do in php now, but refer to it with an ajax request.
I know you said no ajax, but I mean referring to the php file, not the radio stream.
Upvotes: 0