Some questions regarding PHP Scripts

Discuss Shoutcast streaming here, any issues, advice or tips are welcome
Forum rules
Please don't use the forums to report outages, particularly if you are a FreeStreamHosting.org user.

Some questions regarding PHP Scripts

Postby hKyo89 » Sat 14th Nov, 2009 10:37 am

Dear Gavin,
or whoever that is reading my post,

I have some questions regarding PHP Scripts,

1. if we go to Statistics page in ShoutCast control panel, we'll see this:
Stream Info: Stream status, Stream title, Now playing, Genre, Content type, Time GMT

is it possible to get the Stream title into variable in PHP?


2. based on your guidance in Tune in links & scripts:
Code: Select all
if (!$fp)
   $song = "Connection timed out or the server is offline  ";
else {
   fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
   while (!feof($fp))
      $info = fgets($fp);
   $split = explode(',', $info);

   for($i=0;$i<sizeof($split);$i++)
      echo '$split['.$i.'] = '.$split[$i].'<br />';
}


the output would be:
Code: Select all
$split[0] = 1
$split[1] = 1
$split[2] = 1
$split[3] = 1000
$split[4] = 1
$split[5] = 56
$split[6] = F.T ISLAND (에프티 아일랜드) - 나쁜 여자야

if [0] is the number of listeners, and [1] is the stream status,
so, what are [2] and [4]??
I really have no idea with [2],,
and [4] keeps returning the same value as [0]


3. is there another info that I could get into PHP variable?


4. idk what's going on, when I tested the script on remote server, $fp keeps returning "false". but this never happened when I tested the script on my localhost.


5. is it possible to disable the instant chatbox on http://s3.myradiostream.com/stream/{id#}/listen.htm ?


6. is it possible to get the embedded flash player alone? of course, I'll never remove any of your advertisements.



thank you in advance,
hKyo89
 
Posts: 2
Joined: Sat 14th Nov, 2009 9:50 am

Re: Some questions regarding PHP Scripts

Postby Gavin » Sun 15th Nov, 2009 10:36 pm

Hi hKyo89, I'll be happy to answer your questions the best I can.

1. The Stream Title isn't available using the scripts provided, but here's an alternative that should work:

Code: Select all
<?php

$ip = "YOUR SERVER HOST / IP";
$port = "SERVER PORT";

$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp) {
   $streamtitle = "Connection timed out or the server is offline";
} else {
   fputs($fp, "GET /index.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
   while (!feof($fp)) {
      $info = fgets($fp);
   }
   $info = str_replace('</body></html>', "", $info);
   $split = explode('Stream Title: </font></td><td><font class=default><b>', $info);
   $split = explode('</b></td></tr><tr>', $split[1]);
   $streamtitle = $split[0];
}
   
if ($streamtitle) {
   print $streamtitle;
} else {
   print "The stream title is currently empty";
}

?>


2. The variables are as follows:

$split[0] = Total listener connections*
$split[1] = Status (1 = online / 2 = offline)
$split[2] = Listener peak (since server started)
$split[3] = Maximum listeners
$split[4] = Unique listener connections*
$split[5] = Current bitrate
$split[6] = Song title

* Total and Unique listener connections:
Total is the total number of connections to the server
Unique is the number of unique IP addresses connected
These can differ if there are 2 people on the same IP listening (or both behind the same proxy) or if someone is stream ripping.

3. Not with the script supplied, the only variables are above. You could edit the script I gave in (1) to get other info that's listed on :PORT/index.html

4. This normally means that your webhost has a firewally which blocks outgoing connections. If you ask them about it, they might unblock the connection for you.

5. That is something that I'm going to do this week. I wanted to test the chatbox for a few days to make sure it works when there are a lot of users viewing.

6. There is a free version of the flash player here http://www.draftlight.net/dnex/mp3player/minicaster/

We use the paid one, so there might be small differences.

Also, if you embed that you will need the ad code as well which is also available in the scripts area.


I hope that answers everything.
Please don't PM me for support, support system located at:
Customer Support: https://secure.bellonline.co.uk/submitticket.php
FreeStreamHosting Support: http://freestreamhosting.org/support.php
Sales: https://secure.bellonline.co.uk/contact.php
Gavin
Site Admin
 
Posts: 346
Joined: Thu 01st Jan, 1970 1:00 am

Re: Some questions regarding PHP Scripts

Postby hKyo89 » Mon 16th Nov, 2009 3:34 am

wow, thank you for your awesome reply,,
I'll test the script you gave above,,

please do not close this thread,,
there maybe another question regarding this,, ^^

about the flash player,
I even put your ad in my header,,
so it always appear anytime everywhere,
even when you are not opening the player,, lol,,

you can check it here:
http://rss-onair.hkyo89.com

really really really thank you!
hKyo89
 
Posts: 2
Joined: Sat 14th Nov, 2009 9:50 am

Re: Some questions regarding PHP Scripts

Postby Gavin » Tue 24th Nov, 2009 10:59 pm

You're very welcome, if you do need anything else doing with the script then please let me know.

Thank you for supporting the service.
Please don't PM me for support, support system located at:
Customer Support: https://secure.bellonline.co.uk/submitticket.php
FreeStreamHosting Support: http://freestreamhosting.org/support.php
Sales: https://secure.bellonline.co.uk/contact.php
Gavin
Site Admin
 
Posts: 346
Joined: Thu 01st Jan, 1970 1:00 am

Re: Some questions regarding PHP Scripts

Postby onemediapete » Sat 28th Nov, 2009 10:01 am

hi gavin,

as the issues are being discussed here, I thought I would reply rather than add a new topic.

On searching and customising the flash player, I downloaded that free player, but cannot get it working!

If i can get it working were going to go up to the paid one. Here is where I have placed the script to test, and as you see if you try
http://www.onemediaradio.com/cast/
i get:
100:-#- FMP256 Minicaster FREE v4.32c -#-
113:setconfig registered to JavaScript
113:playpause registered to JavaScript
114:Config file loaded and accepted
104:Config defines DNAS playlist file: http://www.onemediaradio.com/cast/listen.pls
105:Config defines info website: http://www.onemediaradio.com
106:Config defines stream title: One Media Radio from Staffordshire University
108:Volume set to 80% by config file
110:DNAS playlist file loaded OK
111:DNAS playlist file parsed OK - 1 entries
120:LOADING 'http://uk3-vn.mixstream.net:8116/' slot=0 XFade=true
121:Stream loaded OK
109:Slot 0 status: Bytes Loaded=4923, Position=0, Duration=0
109:Slot 0 status: Bytes Loaded=4923, Position=0, Duration=0
109:Slot 0 status: Bytes Loaded=4923, Position=0, Duration=0
109:Slot 0 status: Bytes Loaded=4923, Position=0, Duration=0
109:Slot 0 status: Bytes Loaded=4923, Position=0, Duration=0
109:Slot 0 status: Bytes Loaded=4923, Position=0, Duration=0
504:Content of stream does not seem to be music
501:Audio stopped [undefined]


my xml file is:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<config version="1s" xmlns="http://www.draftlight.net/dnex/config/ns/0/">
<mp3cast>
  <playlist>http://www.onemediaradio.com/cast/listen.pls</playlist>
  <website>http://www.onemediaradio.com</website>
  <title>One Media Radio from Staffordshire University</title>
</mp3cast>
<init autoplay="0" volume="80" reload="10" xfade="1" />
</config>


What am I doing wrong?! However, what I want to achieve is the full player with scrolling data from the server, but NO listener counts. And if i can add a second back up stream / or stream option, even better.

I am pretty literate in internet computing, however this is totally stumping me!!!

Any help and assistance would be much appreciated.
Pete
onemediapete
 
Posts: 2
Joined: Sat 28th Nov, 2009 9:53 am

Re: Some questions regarding PHP Scripts

Postby onemediapete » Sat 28th Nov, 2009 12:41 pm

OK! I'm now up and running properly.

So the only thing I'm struggling to get is the now playing info on the flash player.

Please can you help?
onemediapete
 
Posts: 2
Joined: Sat 28th Nov, 2009 9:53 am

Re: Some questions regarding PHP Scripts

Postby Gavin » Mon 30th Nov, 2009 12:29 am

With shoutcast you will need to use the proxy script that comes with it as the flash can't get info from the DNAS.

If you're using the paid service then there should be some javascript that you can put onto your page for the player - that might be the best way.
Please don't PM me for support, support system located at:
Customer Support: https://secure.bellonline.co.uk/submitticket.php
FreeStreamHosting Support: http://freestreamhosting.org/support.php
Sales: https://secure.bellonline.co.uk/contact.php
Gavin
Site Admin
 
Posts: 346
Joined: Thu 01st Jan, 1970 1:00 am

Re: Some questions regarding PHP Scripts

Postby shawn » Sat 19th Dec, 2009 12:03 am

HI IM HOPING I CAN GET SOME HELP FROM AYONE. IVE CREATED A WEBSITE THAT I WOULD LIKE TO STREAM MY FREE HOST FROM. I USED A SCRIPT BUT WHEN LISTENER CLICK THE DREADED UGLY CLICK HERE LINK, IT TAKES THEM AWAY FROM MY WEBSITE, MAKING THEM UNABLE TO CONTINUE TO SEARCH MY SITE. OR CHAT IN MY CHAT ROOM,CAN SOMEONE HELP
shawn
 
Posts: 3
Joined: Sun 29th Nov, 2009 7:25 am
Location: LAS VEGAS


Return to Streaming Discussion

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 1 guest


Website Navigation

For Your Information

Service Updates

Service Status & Stats

Knowledgebase

Community Forums

Contact Details

Sales and General Enquiries

Support Centre

Our Services

MixStream.net
Media streaming services

UKHostingDirect.com
Shared and reseller hosting

LowCostDedi.net
Value dedicated servers

Cast-Control-LITE.net
Licenses from just £2.70

Legal Information

Any personal information we collect on this page will be treated in accordance with our privacy policy.
By viewing this website, you agree to the Website Terms of Use.

Copyright © 2012 Bell Online Ltd. Registered in England & Wales 7234972. W3C Valid - HTML

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO