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!


Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2007
    Location
    UK
    Posts
    2,470
    Tokens
    2,975

    Latest Awards:

    Question Fetch information and show on site.

    Now, what I'm trying to do here is when someone visits the site from there android phone, what I want to do is display the Make, model, ROM Version and android version, I know the first two are possible, but from a quick Google search I found nothing on that topic, can anyone help me?

    Oh, and you can see what I'm trying to do (but remember it does not actually work) at www.mobile.xerom.net

    Basically, I want to fetch the info from the phone, and display it in the phone browser, on the website.

  2. #2
    Join Date
    Aug 2004
    Location
    United Kingdom
    Posts
    5,769
    Tokens
    1,249
    Habbo
    Beneficial

    Latest Awards:

    Default

    The only way I can think of: get a users user agent, which is different for each Android device, then use strpos to dissect the string which gives make, model and Android version (unsure about ROM version?).

    I haven't tested this, so be careful.

    Code:
    <?php 
    $useragent = $_SERVER['HTTP_USER_AGENT'];
    $string = 'HTC_Wildfire';
    
    $pos = strpos($useragent,$string);
    
    if($pos === false) {
     echo "Not a HTC Wildfire";
    }
    else {
     echo "HTC Wildfire";
    }
    ?>
    The user agent gives out something like this:
    Code:
    Mozilla/5.0 (Linux; U; Android 2.1-update1; ar-qa; HTC_Wildfire_A3333  Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile  Safari/530.17
    Obviously, Android 2.1-update1 is the Android version. ar-ga is the language, HTC_Wildfire_A3333 is the phone make and model, and Build/ERE27 is the build.
    Last edited by Homosexual; 20-06-2011 at 12:20 AM.

  3. #3
    Join Date
    Jul 2007
    Location
    UK
    Posts
    2,470
    Tokens
    2,975

    Latest Awards:

    Default

    Quote Originally Posted by Homosexual View Post
    The only way I can think of: get a users user agent, which is different for each Android device, then use strpos to dissect the string which gives make, model and Android version (unsure about ROM version?).

    I haven't tested this, so be careful.

    Code:
    <?php 
    $useragent = $_SERVER['HTTP_USER_AGENT'];
    $string = 'HTC_Wildfire';
    
    $pos = strpos($useragent,$string);
    
    if($pos === false) {
     echo "Not a HTC Wildfire";
    }
    else {
     echo "HTC Wildfire";
    }
    ?>
    The user agent gives out something like this:
    Code:
    Mozilla/5.0 (Linux; U; Android 2.1-update1; ar-qa; HTC_Wildfire_A3333  Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile  Safari/530.17
    Obviously, Android 2.1-update1 is the Android version. ar-ga is the language, HTC_Wildfire_A3333 is the phone make and model, and Build/ERE27 is the build.

    How would I got about stripping that down and displaying it? What i'm thinking of doing is so they come on to the site, and there phone info is already displayed, for any phone, so what I was thinking is in the code, it picks up the information, sets it as a variable, then in the section where I want to display that info it is:

    Code:
     Model: <?php echo blah. ?>
    Would that kind of thing work? Also how would you going around doing it, because honestly I have no idea

    +Rep

  4. #4
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    The ROM version is impossible for you to gather, it's not sent in any header requests or anything.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  5. #5
    Join Date
    Jul 2007
    Location
    UK
    Posts
    2,470
    Tokens
    2,975

    Latest Awards:

    Default

    Quote Originally Posted by Recursion View Post
    The ROM version is impossible for you to gather, it's not sent in any header requests or anything.
    Okay, what I might do then instead is a list of compatible roms it can fetch from the database, when it has the phone information from the user agent

  6. #6
    Join Date
    Aug 2004
    Location
    United Kingdom
    Posts
    5,769
    Tokens
    1,249
    Habbo
    Beneficial

    Latest Awards:

    Default

    I've sent you a PM if you want to reply to it, I've started working on some code to do this so yeah

Posting Permissions

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