php error

Baevus

the names ethan
Nov 4, 2012
565
47
im just gonna say it, im dumb idk

basically this is my problem
PHP:
<?php echo "<img src=\"https://www.habbo.com/habbo-imaging/avatarimage?hb=img&user=<span id=\"cc_strinfo_genre_truehabb\" class=\"cc_streaminfo\">&direction=3&head_direction=3&gesture=sml\" style=\"margin-top: -15px;\">"; ?>

it's supposed to display a habbo avatar.

<span id=\"cc_strinfo_genre_truehabb\" class=\"cc_streaminfo\"> is the habbo avatars username in code.
 

Baevus

the names ethan
Nov 4, 2012
565
47
<span id=\"cc_strinfo_genre_truehabb\" class=\"cc_streaminfo\"> is not their Habboname. Their Habboname will not contain any HTML code.
That is from a shoutcast server, it comes up as text on a webpage with their habbo name as they've set their genre as their habbo name.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Retrieving such SHOUTcast information is a bit harder than what you are trying to do now. You actually need PHP to retrieve data from their XML file, or you could spider (crawl) the site. Anyways, take a look into this:

EDIT:
I found an old script I used before, at the top define your stream's own server IP, server port and password. Then you can use the $aim variable to echo the Habboname if they fill in in the "AIM" field when they connect to the SHOUTcast server.

PHP:
<?php
$scip = "SERVERIP";
$scport = "SERVERPORT";
$scpass = "SERVERPASSWORD";

$scfp = fsockopen($scip, $scport, $errno, $errstr, 10);
if (!$scfp)
{
    $scsuccs = 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);
    }

    $loop = array("STREAMSTATUS", "SERVERTITLE", "CURRENTLISTENERS", "AIM");
    $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++;
    }

    $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++;
    }

    fclose($scfp);
}
 

Baevus

the names ethan
Nov 4, 2012
565
47
Retrieving such SHOUTcast information is a bit harder than what you are trying to do now. You actually need PHP to retrieve data from their XML file, or you could spider (crawl) the site. Anyways, take a look into this:
but out host already gives us these codes. they're already on the site.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
but out host already gives us these codes. they're already on the site.
The data they give you is irrelevant for the thing you want to do. You need the Habboname itself, I think you misunderstood them. Anyways, check my previous post. There is a PHP script in it which will do what you need.
 

Baevus

the names ethan
Nov 4, 2012
565
47
The data they give you is irrelevant for the thing you want to do. You need the Habboname itself, I think you misunderstood them. Anyways, check my previous post. There is a PHP script in it which will do what you need.
Fell asleep, I tried doing this and echoing it and it didn't display an outcome.
There is an XML file hosted by host displaying all stats. I don't know how to convert an XML file into a PHP echo.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Fell asleep, I tried doing this and echoing it and it didn't display an outcome.
There is an XML file hosted by host displaying all stats. I don't know how to convert an XML file into a PHP echo.
This gets the information from the XML file and echo's it. What was the error you got? And did you fill in the AIM value in your SAM Broadcaster?
 

Baevus

the names ethan
Nov 4, 2012
565
47
Please link me to the page and start streaming with a AIM name filled in in your SAM Broadcaster settings.


Code is:
PHP:
<?php
$scip = "`````";
$scport = "8223";
$scpass = "````````";

$scfp = fsockopen($scip, $scport, $errno, $errstr, 10);
if (!$scfp)
{
    $scsuccs = 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);
    }

    $loop = array("STREAMSTATUS", "SERVERTITLE", "CURRENTLISTENERS", "AIM");
    $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++;
    }

    $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++;
    }

    fclose($scfp);
}

echo ( $loop['aim'] );
 

Users who are viewing this thread

Top