Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jan 2013
    Location
    localhost
    Posts
    63
    Tokens
    412
    Habbo
    AaidenX

    Latest Awards:

    Default [Help] PHP Script Problem

    Ok, so I need a PHP script to show a habbo user's motto, and did find a script but it doesn't actually seem to work.

    PHP Code:
    <?php
     
            
    class generator
            
    {
     
                    var 
    $data;
                    var 
    $habboname;
                    var 
    $hotel;
                    var 
    $url;
     
                    function 
    generator$habboname$hotel )
                    {
     
                            
    $this->habboname $habboname;
                            
    $this->hotel     $hotel;
                            
    $this->url       "http://habbo." $hotel "/home/" $habboname;
                            
    $this->data      = @file_get_contents$this->url );
     
                    }
     
                    function 
    offline() {
     
                            if( 
    eregi"User personal habbo page is hidden"$this->data ) or !$this->name() ) {
     
                                    return 
    true;
     
                            }
                            else {
     
                                    return 
    false;
     
                            }
     
                    }
     
     
     
                    function 
    online()
                    {
     
                            if ( 
    eregi"habbo_online_anim.gif"$this->data ) )
                            {
     
                                    return 
    true;
     
                            }
                            else
                            {
     
                                    return 
    false;
     
                            }
     
                    }
     
                    function 
    motto()
                    {
     
                            
    $motto explode"<div class=\"profile-motto\">"$this->data );
                            
    $motto explode"<div"$motto[1] );
                            
    $motto trim($motto[0]);
     
                            return 
    $motto;
     
                    }
     
                    function 
    badge()
                    {
     
                            if( 
    eregi"c_images/album1584/"$this->data ) )
                            {
     
                                    
    $badge explode"/c_images/album1584/"$this->data );
                                    
    $badge explode".gif"$badge[1] );
                                    
    $badge trim$badge[0] );
                                    
    $badge "http://images.habbo.com/c_images/album1584/" $badge ".gif";
     
                                    return 
    $badge;
     
                            }
                            else
                            {
     
                                    return 
    false;
     
                            }
     
                    }
     
                    function 
    figure()
                    {
     
                            
    $figure "http://www.habbo." $this->hotel "/habbo-imaging/avatarimage?user=" $this->habboname "&action=&direction=2&head_direction=3&gesture=sml&size=l&img_format=gif";
                            return 
    $figure;
     
                    }
     
                    function 
    birthDate()
                    {
     
                            
    $birthdate explode"<div class=\"birthday date\">"$this->data );
                            
    $birthdate explode"</div>"$birthdate[1] );
                            
    $birthdate trim$birthdate[0] );
     
                            return 
    $birthdate;
     
                    }
     
                    function 
    name()
                    {
     
                            
    $name explode"<span class=\"name-text\">"$this->data );
                            
    $name explode"</span>"$name[1] );
                            
    $name trim$name[0] );
     
                            return 
    $name;
     
                    }
     
                    function 
    groupBadge()
                    {
     
                            if( 
    eregi"/habbo-imaging/badge/"$this->data ) )
                            {
     
                                    
    $badge explode"/habbo-imaging/badge/"$this->data );
                                    
    $badge explode".gif"$badge[1] );
                                    
    $badge trim$badge[0] );
                                    
    $badge "http://www.habbo." $this->hotel "/habbo-imaging/badge/" $badge ".gif";
     
                                    return 
    $badge;
     
                            }
                            else
                            {
     
                                    return 
    false;
     
                            }
     
                    }  
     
            }
           
            
    $habbo $_GET['name'];
           
            switch( 
    $_GET['hotel'] ) {
           
                    case 
    'au':
                    
    $hotel "com.au";
                    break;
                   
                    case 
    'sg':
                    
    $hotel "com.sg";
                    break;
                   
                    case 
    'us':
                    
    $hotel "com";
                    break;
                   
                    case 
    'ca':
                    
    $hotel "ca";
                    break;
                   
                    default:
                    
    $hotel "co.uk";
                    break;
           
            }
    ?>
    <?php
            
    if( $motto $data->name() ){
                    echo 
    $motto;
            }
    ?>
    But if you have a better script than this/working one, please pass it to me. I would be also appreciated if you made that one working.

  2. #2
    Join Date
    Mar 2010
    Location
    Cornwall (UK)
    Posts
    2,329
    Tokens
    6,755
    Habbo
    -Nick

    Latest Awards:

    Default

    Quote Originally Posted by AaidenX View Post
    Ok, so I need a PHP script to show a habbo user's motto, and did find a script but it doesn't actually seem to work.

    PHP Code:
    <?php
     
            
    class generator
            
    {
     
                    var 
    $data;
                    var 
    $habboname;
                    var 
    $hotel;
                    var 
    $url;
     
                    function 
    generator$habboname$hotel )
                    {
     
                            
    $this->habboname $habboname;
                            
    $this->hotel     $hotel;
                            
    $this->url       "http://habbo." $hotel "/home/" $habboname;
                            
    $this->data      = @file_get_contents$this->url );
     
                    }
     
                    function 
    offline() {
     
                            if( 
    eregi"User personal habbo page is hidden"$this->data ) or !$this->name() ) {
     
                                    return 
    true;
     
                            }
                            else {
     
                                    return 
    false;
     
                            }
     
                    }
     
     
     
                    function 
    online()
                    {
     
                            if ( 
    eregi"habbo_online_anim.gif"$this->data ) )
                            {
     
                                    return 
    true;
     
                            }
                            else
                            {
     
                                    return 
    false;
     
                            }
     
                    }
     
                    function 
    motto()
                    {
     
                            
    $motto explode"<div class=\"profile-motto\">"$this->data );
                            
    $motto explode"<div"$motto[1] );
                            
    $motto trim($motto[0]);
     
                            return 
    $motto;
     
                    }
     
                    function 
    badge()
                    {
     
                            if( 
    eregi"c_images/album1584/"$this->data ) )
                            {
     
                                    
    $badge explode"/c_images/album1584/"$this->data );
                                    
    $badge explode".gif"$badge[1] );
                                    
    $badge trim$badge[0] );
                                    
    $badge "http://images.habbo.com/c_images/album1584/" $badge ".gif";
     
                                    return 
    $badge;
     
                            }
                            else
                            {
     
                                    return 
    false;
     
                            }
     
                    }
     
                    function 
    figure()
                    {
     
                            
    $figure "http://www.habbo." $this->hotel "/habbo-imaging/avatarimage?user=" $this->habboname "&action=&direction=2&head_direction=3&gesture=sml&size=l&img_format=gif";
                            return 
    $figure;
     
                    }
     
                    function 
    birthDate()
                    {
     
                            
    $birthdate explode"<div class=\"birthday date\">"$this->data );
                            
    $birthdate explode"</div>"$birthdate[1] );
                            
    $birthdate trim$birthdate[0] );
     
                            return 
    $birthdate;
     
                    }
     
                    function 
    name()
                    {
     
                            
    $name explode"<span class=\"name-text\">"$this->data );
                            
    $name explode"</span>"$name[1] );
                            
    $name trim$name[0] );
     
                            return 
    $name;
     
                    }
     
                    function 
    groupBadge()
                    {
     
                            if( 
    eregi"/habbo-imaging/badge/"$this->data ) )
                            {
     
                                    
    $badge explode"/habbo-imaging/badge/"$this->data );
                                    
    $badge explode".gif"$badge[1] );
                                    
    $badge trim$badge[0] );
                                    
    $badge "http://www.habbo." $this->hotel "/habbo-imaging/badge/" $badge ".gif";
     
                                    return 
    $badge;
     
                            }
                            else
                            {
     
                                    return 
    false;
     
                            }
     
                    }  
     
            }
           
            
    $habbo $_GET['name'];
           
            switch( 
    $_GET['hotel'] ) {
           
                    case 
    'au':
                    
    $hotel "com.au";
                    break;
                   
                    case 
    'sg':
                    
    $hotel "com.sg";
                    break;
                   
                    case 
    'us':
                    
    $hotel "com";
                    break;
                   
                    case 
    'ca':
                    
    $hotel "ca";
                    break;
                   
                    default:
                    
    $hotel "co.uk";
                    break;
           
            }
    ?>
    <?php
            
    if( $motto $data->name() ){
                    echo 
    $motto;
            }
    ?>
    But if you have a better script than this/working one, please pass it to me. I would be also appreciated if you made that one working.
    not a pro but surely

    PHP Code:
                             $this->url       "http://habbo.com" $hotel "/home/" $habboname


    Quote Originally Posted by xxMATTGxx View Post
    Nick is harmless and he's not a bad person after you have spoken to him a few times.
    Last +REP from: Kardan


  3. #3
    Join Date
    Jan 2013
    Location
    localhost
    Posts
    63
    Tokens
    412
    Habbo
    AaidenX

    Latest Awards:

    Default

    Not working!

    My errors:

    PHP Code:
    NoticeUndefined indexname in C:\Xampp\htdocs\Files\index.php on line 146

    Notice
    Undefined indexhotel in C:\Xampp\htdocs\Files\index.php on line 148

    Notice
    Undefined variabledata in C:\Xampp\htdocs\Files\index.php on line 173

    Fatal error
    Call to a member function name() on a non-object in C:\Xampp\htdocs\Files\index.php on line 173 
    Last edited by AaidenX; 04-07-2013 at 09:02 AM.

  4. #4
    Join Date
    Jun 2005
    Location
    /dev/null
    Posts
    4,918
    Tokens
    126

    Latest Awards:

    Default

    Have you instantiated $data as an object of the generator class?

    PHP Code:
    $data = new generator
    Before you try and use it.

  5. #5
    Join Date
    Feb 2008
    Location
    London, UK
    Posts
    15,747
    Tokens
    25,786
    Habbo
    Mr-Trainor

    Latest Awards:

    Default

    Quote Originally Posted by -Nick View Post
    not a pro but surely

    PHP Code:
                             $this->url       "http://habbo.com" $hotel "/home/" $habboname
    The $hotel part will add that in, so if the user chose the .com hotel then the . $hotel . Would be .com and fill it in . So op if you put .com in manually then you should take away the . $hotel . .

    Not online very often

  6. #6
    Join Date
    Oct 2012
    Location
    Nottingham
    Posts
    85
    Tokens
    473
    Habbo
    FlyingPigs!

    Default

    Try this

    PHP Code:
    <?php
     
            
    class generator
            
    {
     
                    var 
    $data;
                    var 
    $habboname;
                    var 
    $hotel;
                    var 
    $url;
     
                    function 
    generator$habboname$hotel )
                    {
     
                            
    $this->habboname $habboname;
                            
    $this->hotel     $hotel;
                            
    $this->url       "http://habbo." $hotel "/home/" $habboname;
                            
    $this->data      = @file_get_contents$this->url );
     
                    }
     
                    function 
    offline() {
     
                            if( 
    eregi"User personal habbo page is hidden"$this->data ) or !$this->name() ) {
     
                                    return 
    true;
     
                            }
                            else {
     
                                    return 
    false;
     
                            }
     
                    }
     
     
     
                    function 
    online()
                    {
     
                            if ( 
    eregi"habbo_online_anim.gif"$this->data ) )
                            {
     
                                    return 
    true;
     
                            }
                            else
                            {
     
                                    return 
    false;
     
                            }
     
                    }
     
                    function 
    motto()
                    {
     
                            
    $motto explode"<div class=\"profile-motto\">"$this->data );
                            
    $motto explode"<div"$motto[1] );
                            
    $motto trim($motto[0]);
     
                            return 
    $motto;
     
                    }
     
                    function 
    badge()
                    {
     
                            if( 
    eregi"c_images/album1584/"$this->data ) )
                            {
     
                                    
    $badge explode"/c_images/album1584/"$this->data );
                                    
    $badge explode".gif"$badge[1] );
                                    
    $badge trim$badge[0] );
                                    
    $badge "http://images.habbo.com/c_images/album1584/" $badge ".gif";
     
                                    return 
    $badge;
     
                            }
                            else
                            {
     
                                    return 
    false;
     
                            }
     
                    }
     
                    function 
    figure()
                    {
     
                            
    $figure "http://www.habbo." $this->hotel "/habbo-imaging/avatarimage?user=" $this->habboname "&action=&direction=2&head_direction=3&gesture=sml&size=l&img_format=gif";
                            return 
    $figure;
     
                    }
     
                    function 
    birthDate()
                    {
     
                            
    $birthdate explode"<div class=\"birthday date\">"$this->data );
                            
    $birthdate explode"</div>"$birthdate[1] );
                            
    $birthdate trim$birthdate[0] );
     
                            return 
    $birthdate;
     
                    }
     
                    function 
    name()
                    {
     
                            
    $name explode"<span class=\"name-text\">"$this->data );
                            
    $name explode"</span>"$name[1] );
                            
    $name trim$name[0] );
     
                            return 
    $name;
     
                    }
     
                    function 
    groupBadge()
                    {
     
                            if( 
    eregi"/habbo-imaging/badge/"$this->data ) )
                            {
     
                                    
    $badge explode"/habbo-imaging/badge/"$this->data );
                                    
    $badge explode".gif"$badge[1] );
                                    
    $badge trim$badge[0] );
                                    
    $badge "http://www.habbo." $this->hotel "/habbo-imaging/badge/" $badge ".gif";
     
                                    return 
    $badge;
     
                            }
                            else
                            {
     
                                    return 
    false;
     
                            }
     
                    }  
     
            }
           
            
    $habbo $_GET['name'];
           
            switch( 
    $_GET['hotel'] ) {
           
                    case 
    'au':
                    
    $hotel "com.au";
                    break;
                   
                    case 
    'sg':
                    
    $hotel "com.sg";
                    break;
                   
                    case 
    'us':
                    
    $hotel "com";
                    break;
                   
                    case 
    'ca':
                    
    $hotel "ca";
                    break;
                   
                    default:
                    
    $hotel "co.uk";
                    break;
           
            }
    ?>
    <?php
            $mottof 
    = new generator();
            
    $mottof->generator($habbo$_GET['hotel']);

            echo 
    $mottof->motto();
    ?>
    Testing it right now and will update.

  7. #7
    Join Date
    Oct 2012
    Location
    Nottingham
    Posts
    85
    Tokens
    473
    Habbo
    FlyingPigs!

    Default

    Sorry for double posting but it looks like Habbo has updated its homepage system and requires a certain cookie. This code should work.

    PHP Code:
    <?php
    class Habbo
    {

        public function 
    get_data($uri)
        {
            if (!
    function_exists('curl_init')) {
                die(
    'Curl is not installed!');
            }

            
    $ch curl_init();
            
    curl_setopt($chCURLOPT_URL$uri);
            
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
            
    curl_setopt($chCURLOPT_COOKIE"YPF8827340282Jdskjhfiw_928937459182JAX666=" .
                
    $_SERVER["SERVER_ADDR"] . ";DOAReferrer=;");
            
    $useragent "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
            
    curl_setopt($chCURLOPT_USERAGENT$useragent);
            
    curl_setopt($chCURLOPT_REFERER"habbo.com");
            
    $output curl_exec($ch);
            
    curl_close($ch);
            return 
    $output;
        }

        public function 
    getMotto($username$hotel)
        {
            
    $page $this->get_data("http://www.habbo." $hotel "/home/" $username);

            if (
    strpos($page'<div class="profile-motto">') !== false) {
                
    $split explode('<div class="profile-motto">'$page);
                
    $split explode("<div"$split[1]);

                return 
    $split[0];
            } else {
                return 
    "No motto found";
            }
        }
    }

    $habbo = new Habbo;

    echo 
    $habbo->getMotto("happy""com");
    ?>
    cURL is required and won't work on my localhost

  8. #8
    Join Date
    Jan 2013
    Location
    localhost
    Posts
    63
    Tokens
    412
    Habbo
    AaidenX

    Latest Awards:

    Default

    @FlyingPigs it returns with no motto found! so yh... cURL is installed in my XAMPP

  9. #9
    Join Date
    Oct 2005
    Location
    Spain, Valencia
    Posts
    20,492
    Tokens
    3,575
    Habbo
    GoldenMerc

    Latest Awards:

    Default

    Afaik its impossible now as Sulake had a big problem with someone searching all the badges etc

    Sent from my HTC One using Tapatalk

  10. #10
    Join Date
    Nov 2008
    Posts
    217
    Tokens
    1,822
    Habbo
    eLv

    Latest Awards:

    Default

    Just wanna say that grabbing only the basic details like avatar, online status, created date and motto is still available remotely even with the user profile being set to private, as seen on HabboEmotion: http://habboemotion.com/#habinfo

    Badges and friends need a unique widget id which verify if the user have the widget or their profile shown, else it won't work. This only applies to the international hotels I think as I can still use old codes on other hotels to retrieve their badges and friends regardless their profile is set to hidden.

    Just sharing.

    Sent using mobile






Page 1 of 2 12 LastLast

Posting Permissions

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