Results 1 to 2 of 2
  1. #1

    Title
    Junior Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Pls Help with Now Playing Script

    Please can someone help me with a script? I've searched everywhere for ages now and have found a few but they do not do exactly what i'm after and i don't know php

    Basically my host only allows some functions so the php needs to use "fsockopen" as i know it works.

    Just two rules:

    If fsockopen is open then display the song artist/title

    If fsockopen is closed then show Server Offline

    I've tried loads now but the closest i got to one doesn't use fsockopen and the page keeps trying to load when server is offline instead of just displaying

  2. #2

    Title
    Junior Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0
    The below would be perfect but it is for a shoutcast server and i need icecast:

    Can anyone convert?

    index.php
    Code:
    <html>
    <head>
    <script type="text/javascript" src="./jquery.js"></script>
    <script type="text/javascript">
    function updateNowPlaying(){
     $.ajax({
      url: "./now-playing.php",
      cache: false,
      success: function(html){
       $("#nowPlaying").html(html);
      }
     });
    }
    updateNowPlaying();
    setInterval( "updateNowPlaying()", 10000 );
    </script>
    </head>
    <body bgcolor="#171717">
    <center>
    <font size="3" color="ff0000"><b>
    <div id="nowPlaying"></div></b>
    </font>
    </center>
    </body>
    </html>
    now-playing.php
    Code:
    <?php
    /*
    Now Playing PHP script for SHOUTcast
    This script is (C) MixStream.net 2008
    Feel free to modify this free script 
    in any other way to suit your needs.
    Version: v1.1
    */
     
    /* ----------- Server configuration ---------- */
    $ip = "host.host.net";
    $port = "9999";
    /* ----- No need to edit below this line ----- */
    /* ------------------------------------------- */
    $fp = @fsockopen($ip,$port,$errno,$errstr,1);
    if (!$fp) 
     { 
     echo "OFF AIR - Tune In At 6pm"; // Diaplays when sever 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);
      }
     $info = str_replace('</body></html>', "", $info);
     $split = explode(',', $info);
     if (empty($split[6]) )
      {
      echo "The current song is not available"; // Diaplays when sever is online but no song title
      }
     else
      {
      $title = str_replace('\'', '`', $split[6]);
      $title = str_replace(',', ' ', $title);
      echo "$title"; // Diaplays song
      }
     }
    ?>

Similar Threads

  1. US Cable companies think Internet TV should not be free
    By saint in forum General Internet Radio Discussions
    Replies: 5
    Last Post: 09-01-2011, 06:06 PM
  2. Protools vs Audition
    By Jinglemaster in forum Audio Production
    Replies: 9
    Last Post: 07-28-2010, 12:18 AM
  3. Intel Wants to Put the Internet Inside Your TV
    By saint in forum General Internet Radio Discussions
    Replies: 0
    Last Post: 09-26-2009, 02:56 PM
  4. Broadcasting Browse Stations Link Error
    By billh in forum Forum Rules & Announcements
    Replies: 3
    Last Post: 04-19-2009, 12:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •