December 30, 200916 yr Hello. Creating a new website for an internet radio station called TuneVibez, and was wondering how I could make an audio stream status indicator (To show when the radio is ON AIR and OFF AIR) All I need is for a script to detect if the stream is LIVE or not and show the corresponding image. Is that possible, how? The audio stream is: http://86.151.233.232:8000/listen.m3u (Not broadcasting at the moment)
December 30, 200916 yr Author Are you using Shoutcast? The person who I am making the website for is using an Icecast 2 server.
December 30, 200916 yr I made a similar site a couple years ago, I had a look for the code but I think it will only work for ShoutCast. I found this on Google though, which looks quite similar - except it's for IceCast
December 30, 200916 yr Author I made a similar site a couple years ago, I had a look for the code but I think it will only work for ShoutCast. I found this on Google though, which looks quite similar - except it's for IceCast Hey thanks for your help, but I have found this, would this work? http://www.tinyportal.net/index.php?topic=23557.0
December 30, 200916 yr Hey thanks for your help, but I have found this, would this work? http://www.tinyportal.net/index.php?topic=23557.0 It's worth a try but don't use the iframe. Save your page as .php and then put the following code where you want the result to show (instead of the iframe): <?php include("radio_stats.php"); ?> If it does work, then remove all the extra HTML from the radio_stats file, so that you're only left with it printing the status (no head, styles etc) otherwise your page won't validate.
December 30, 200916 yr Author It's worth a try but don't use the iframe. Save your page as .php and then put the following code where you want the result to show (instead of the iframe): <?php include("radio_stats.php"); ?> If it does work, then remove all the extra HTML from the radio_stats file, so that you're only left with it printing the status (no head, styles etc) otherwise your page won't validate. Ok for now I am using the iFrame (Will change when I get it working) The stream is offline at the moment, it should display the off air image that I created, but instead it says "Warning: Call-time pass-by-reference has been deprecated in /home/content/c/h/a/charl13/html/tunevibez/radio_stats.php on line 17 Warning: Call-time pass-by-reference has been deprecated in /home/content/c/h/a/charl13/html/tunevibez/radio_stats.php on line 17 Warning: fsockopen() [function.fsockopen]: unable to connect to 86.151.233.232:8000 (Connection refused) in /home/content/c/h/a/charl13/html/tunevibez/radio_stats.php on line 17 is Offline"
December 30, 200916 yr First 2 are fixable, the third means that you can't connect to your IceCast server to get the stream details using fsocket(). The link I provided uses fopen() so you might have better luck with that.
December 31, 200916 yr Author First 2 are fixable, the third means that you can't connect to your IceCast server to get the stream details using fsocket(). The link I provided uses fopen() so you might have better luck with that. Ok, I'll try the link you gave, could you explain to me in simple terms how to set it up? Thanks (:
December 31, 200916 yr Sure: 1) Download the class from the bottom of the page. 2) Create a new file called stream_status.php file (save it from any editor like Dreamweaver or Notepad(++) etc) 3) Inside it put: <?php include("icecast.class.php"); $i = new IceCast(); $i->host = 'http://streamipordomain.com/'; //EDIT THIS $i->port = '8000'; //port stream is broadcast on //EDIT THIS $i->passwd = 'adminPa$$'; //stats admin password //EDIT THIS if($i->openstats()) { if($i->getStreamStatus()) { echo "Now streaming"; //EDIT AS NEEDED } else { echo "Currently offline"; //EDIT AS NEEDED } } else { //server could not be connected to or is offline echo "Unable to connect, refresh or try again later"; //EDIT AS NEEDED } ?> In your webpage (which needs to be saved as .php) wherever you want the status put: <?php include("stream_status.php"); ?> I've put comments in the PHP above telling you what you need to change ("EDIT THIS"), and some optional changes that you can make ("EDIT AS NEEDED"). I've not tested it, so let me know how it goes!
December 31, 200916 yr Author Ahh you've made it really simple, thanks! I'll keep you posted on how it goes!
December 31, 200916 yr Author Installed as instructed, we have an error. http://cbgfilms.com.previewdns.com/tunevibez/ (top right)
December 31, 200916 yr I've just read through the code about 5 times and can't find any error with it. I'm guessing that it's either something wrong after you edited it, or something that I'm missing because it's so obvious.
December 31, 200916 yr Author I've just read through the code about 5 times and can't find any error with it. I'm guessing that it's either something wrong after you edited it, or something that I'm missing because it's so obvious. Heres the code: <?php include("icecast.class.php"); $i = new IceCast(); $i->host = 'http://86.151.233.232/'; //EDIT THIS $i->port = '8000'; //port stream is broadcast on //EDIT THIS $i->passwd = '******'; //stats admin password //EDIT THIS if($i->openstats()) { if($i->getStreamStatus()) { echo "Now streaming"; //EDIT AS NEEDED } else { echo "Currently offline"; //EDIT AS NEEDED } } else { //server could not be connected to or is offline echo "Unable to connect, refresh or try again later"; //EDIT AS NEEDED } ?> Maybe the password isnt right could that be why it is giving that error?
December 31, 200916 yr Everything still looks fine, and works fine when I tried it on localhost. If the password is wrong it would just say unable to connect, and probably give a different error. Are there any symbols in the password or is it all letters and numbers?
December 31, 200916 yr Author Everything still looks fine, and works fine when I tried it on localhost. If the password is wrong it would just say unable to connect, and probably give a different error. Are there any symbols in the password or is it all letters and numbers? its just a plain 7 letter password
December 31, 200916 yr Guess I'm out of ideas then. Like I say, seems to work fine here. Could be a server-side issue, but I have no idea what. Just hoping someone else can come along and spot the obvious.
January 2, 201016 yr Author Hey guys, just realised I never downloaded the other file from the site and uploaded it to my host. I have now done that and now have this error: Warning: fopen(http://...@83.170.104.91:30355/admin/stats) [function.fopen]: failed to open stream: Connection refused in /home/content/c/h/a/charl13/html/tunevibez/icecast.class.php on line 61 Unable to connect, refresh or try again later Any help?
January 3, 201016 yr Author Oh we have changed servers since then, thats why the URLs are different, dont worry about that part.
January 3, 201016 yr Author we have since tried it using curl now we get an error saying Unable to connect refresh or try again later
January 14, 201016 yr Hey CBG, I'm the person who created the icecast.class.php file you were trying to use. I thought i'd offer my help in trying to get it working for you. I made the object for my own use (obviously) and it has been a champ since day one. I'm currently using it to display current song information on websites as well as collecting number of listeners for tracking stats for the stream. Just a bit of background, and to let you know that i'm confident the object is not the problem. Your code looks fine and i tried going to the stats URL for the stream your working with. I was prompted for login so looks like thats all accessible. No problem on the icecast end. NOTE: Icecast allows for the admin username to be changed to something other than admin, but this doesn't normally happen. If its not admin, you'll need to modify some things, but i can show you were. By the looks of the error message, your server doesn't allow the use of the fopen functions (fsocket, fopen, fsockopen, etc.). This is commonly disabled by hosting providers. This may be why cURL is also not working, again, it is commonly disabled by hosting providers. I would suggest checking your providers FAQ or help section to see if thats the case. I highly suspect that will be the problem. Hope it helps Tyler http://minded.ca/
Create an account or sign in to comment