Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2005
    Location
    nottingham
    Posts
    23
    Tokens
    1,389

    Latest Awards:

    Unhappy errors with radio stats

    hi im in need off some help, i have a radio_stats code php page when i have the details correct and pages linked correctly i get a

    Warning: fsockopen() [function.fsockopen]: unable to connect to 66.79.188.157:8220 in /home/habbomel/public_html/radio_stats.php on line 3
    www.habbomelody.com


    below is my config code
    PHP Code:
    <?php
    $scdef 
    "www.habbomelody.com";               // Default station name to display when server or stream is down
    $scip "";           // ip or url of shoutcast server (DO NOT ADD HTTP:// )
    $scport "";                         // port of shoutcast server
    $scpass "";                   // password to shoutcast server
    ?>
    obvious my details are in the part but im not going to say them on here.

    and here is my radio_stats code
    [PHP]<?php
    include('sn_config_radio.php'); //you may edit this path to fit your server environment otherwise leave it alone
    $scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
    if(!$scfp) {
    $scsuccs=1;
    echo''.$scdef.'1';
    }
    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($scfp, 1000);
    }

    ################################################## ################################################## ##################
    /////////////////////////part 1
    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    //define xml elements
    $loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS");
    $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);

    // uncomment the next line to see all variables
    //echo'$'.$scphp.' = '.$$scphp.'<br>';
    $y++;
    }
    //end intro xml elements
    ################################################## ################################################## ##################
    ################################################## ################################################## ##################
    /////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    //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'
    <html>

    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <link rel=stylesheet href="" type="text/css">
    <title>'.$scdef.'</title>
    </head>

    <body text="#000000" bgcolor="#99CCFF">

    <font face="Tahoma" size="1">
    <b>&nbsp;Dj:</b>&nbsp;'.$servertitle.'</p>
    <b>&nbsp;Listeners:</b>&nbsp;'.$currentlisteners.'</p>
    <b>
    Current Song:</b> '.$song[0].'
    <br>
    <br>
    <b>Past Songs:</b>
    <br>
    <b>1.</b> '.$song[1].'<BR>
    <b>2.</b> '.$song[2].'<BR>
    <b>3.</b> '.$song[3].'<BR>
    <b>4.</b> '.$song[4].'<BR>
    </font>
    </body>
    </html>';
    }
    if($streamstatus == "0")
    {
    echo'
    <html>
    </body>

    <head>
    <title>Radio Server Is Offline</title>
    </head>


    </body>
    </html>';
    }
    ?>[/
    PHP]

    with this code i keep getting the errors can anyone help me.

    if it helps im using the php page on my main website host
    if that is related to remote connections.

  2. #2
    Join Date
    Aug 2008
    Location
    32nd cardboard box walsall
    Posts
    65
    Tokens
    0

    Default

    have you tried using diff stats?

  3. #3
    Join Date
    Aug 2008
    Location
    Canada
    Posts
    9
    Tokens
    0

    Default

    Try using different stats as said above. Good Luck!

  4. #4
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    I knew my tut would be useful, even on habboxforum. Read this thread, and tell your host about it too:

    http://www.habboxforum.com/showthread.php?t=513298
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  5. #5

    Default

    Your host might not have that port open as well. Everytime I change radio servers, and have a different port, I have to get my host to open it.

Posting Permissions

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