Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default An error already! Hehe

    As expected, i don't do php for a few months, come back and DUH! Lol

    I just bought a shoutcast server and im having trouble with the stats

    It says theres an error connecting to the ip. I don't know if this is because the host hasn't allowed access adn i need to contact them? Any help will be +Repped

    PHP Code:
    <?
    // ** CONFIGURATION ** - Please enter details within the speech marks
    //Radio IP
    $scip "78.129.167.15";
    //Radio port
    $scport "8262";
    //Radio password
    $scpass "MYPASSWORD :)";
    //If offline, say:
    $offlinemsg "Sorry! The radio is currently offline!";
    // ** END CONFIGURATION **
    $scfp fsockopen("$scip"$scport, &$errno, &$errstr30);
    if(!
    $scfp) {
       
    $scsuccs=1;
    echo 
    $offlinemsg
     }
    if(
    $scsuccs!=1){
       
    fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
       while(!
    feof($scfp)) {
          
    $page .= fgets($scfp1000);
       }
    //define  xml elements
    $loop = array("STREAMSTATUS""BITRATE""SERVERTITLE""CURRENTLISTENERS""MAXLISTENERS""BITRATE");
    $y=0;
    while(
    $loop[$y]!=''){
       
    $pageed ereg_replace(".*<$loop[$y]>"""$page);
       
    $scphp strtolower($loop[$y]);
       $
    $scphp ereg_replace("</$loop[$y]>.*"""$pageed);
       if(
    $loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
          $
    $scphp urldecode($$scphp);
       
    $y++;
    }
    //end intro xml elements
    //get song info and history
    $pageed ereg_replace(".*<SONGHISTORY>"""$page);
    $pageed ereg_replace("<SONGHISTORY>.*"""$pageed);
    $songatime explode("<SONG>"$pageed);
    $r=1;
    while(
    $songatime[$r]!=""){
       
    $t=$r-1;
       
    $playedat[$t] = ereg_replace(".*<PLAYEDAT>"""$songatime[$r]);
       
    $playedat[$t] = ereg_replace("</PLAYEDAT>.*"""$playedat[$t]);
       
    $song[$t] = ereg_replace(".*<TITLE>"""$songatime[$r]);
       
    $song[$t] = ereg_replace("</TITLE>.*"""$song[$t]);
       
    $song[$t] = urldecode($song[$t]);
       
    $dj[$t] = ereg_replace(".*<SERVERTITLE>"""$page);
       
    $dj[$t] = ereg_replace("</SERVERTITLE>.*"""$pageed);
    $r++;
    }
    //end song info
    fclose($scfp);
    }
    //display stats
    if($streamstatus == "1"){
    //you may edit the html below, make sure to keep variable intact
    echo "
    <p align=center><center>
    <b>DJ:</b> 
    $servertitle<br>
    <b>Listeners:</b> 
    $currentlisteners / $maxlisteners<br>
    <b>Current Song:</b> 
    $song[0]</p>
    <p><b>Song History</b></p>
    <p><b>1.</b> 
    $song[1]<br>
    <b>2.</b> 
    $song[2]<br>
    <b>3.</b> 
    $song[3]<br>
    <b>4.</b> 
    $song[4]<br></p>
    "
    ;
    }
    //If radio is offline.
    if($streamstatus == "0")
    {
    echo 
    "<p>$offlinemsg</p>";
    }
    ?>

  2. #2
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Well thanks for all your help lmao.

    But i got it sorted, was my hosts firewall.

Posting Permissions

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