Runescape stats?

Discussion in 'Web Programming' started by haskabab, Oct 2, 2009.

Runescape stats?
  1. Unread #1 - Oct 2, 2009 at 6:55 AM
  2. haskabab
    Joined:
    Aug 29, 2009
    Posts:
    1
    Referrals:
    1
    Sythe Gold:
    5

    haskabab Newcomer

    Runescape stats?

    How do you get the stats from a player from the runescape site?

    So far i could only figure out how to actually open the page etc.. not so hard. but how do i strip everything except for the levels and put them into vars?

    Thanks in advance.
     
  3. Unread #2 - Oct 2, 2009 at 6:56 AM
  4. AcesHigh
    Joined:
    Dec 23, 2008
    Posts:
    266
    Referrals:
    0
    Sythe Gold:
    0

    AcesHigh Forum Addict
    Banned

    Runescape stats?

    What the fu**?
     
  5. Unread #3 - Oct 2, 2009 at 9:53 AM
  6. SuF
    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary

    SuF Legend
    Pirate Retired Global Moderator

    Runescape stats?

  7. Unread #4 - Oct 2, 2009 at 8:38 PM
  8. new user 1000
    Joined:
    Jul 13, 2009
    Posts:
    211
    Referrals:
    0
    Sythe Gold:
    0

    new user 1000 Active Member
    Banned

    Runescape stats?

  9. Unread #5 - Oct 12, 2009 at 6:13 PM
  10. 'DnB'
    Joined:
    Apr 24, 2008
    Posts:
    145
    Referrals:
    0
    Sythe Gold:
    0

    'DnB' Active Member
    Banned

    Runescape stats?

    You should use the lite version of the hiscores like so.

    http://hiscore.runescape.com/index_lite.ws?player=Username

    That produces a string with rank, level, exp - starting with overall then iterating through the skills then on to the minigames ( rank, score )

    They're separated with commas so a simple explode() would do the trick.. PM me with any questions if you need
     
  11. Unread #6 - Oct 17, 2009 at 11:42 PM
  12. AADude
    Joined:
    Apr 3, 2008
    Posts:
    43
    Referrals:
    0
    Sythe Gold:
    0

    AADude Member

    Runescape stats?

    To answer your question: parse the data received from the link 'DnB' posted. For example:

    (sample data) http://hiscore.runescape.com/index_lite.ws?player=Zezima
    Code:
    403,2372,1224767936
    421,99,59476460
    242,99,56616722
    1207,99,39565202
    200,99,61287324
    232,99,37119213
    454,99,14155051
    24,99,63827235
    5,99,200000000
    1960,99,22203111
    56,99,113793712
    504,99,27239316
    25,99,117368919
    236,99,18094553
    160,99,17565654
    614,99,15789879
    8,99,57473823
    1298,99,13592655
    5,99,200000000
    572,99,18641464
    375,99,19458833
    690,99,16113397
    7011,99,13187289
    625,99,13229510
    5341,95,8968614
    2539,1944
    -1,-1
    -1,-1
    -1,-1
    -1,-1
    
    I would first put these values into an array, separating by newlines. Then, I would display the rank, level, and xp for each skill until the last five (which are minigame ranks and scores.)

    PHP:
    <?php
        $parse
    ["config"]["username"] = "Zezima";
        
    $parse["config"]["skills"] = array("Overall""Attack""Defence""Strength""Hitpoints""Ranged""Prayer""Magic""Cooking""Woodcutting""Fletching""Fishing""Firemaking""Crafting""Smithing""Mining""Herblore""Agility""Thieving""Slayer""Farming""Runecrafting""Hunter""Construction""Summoning");
        
    $parse["config"]["minigames"] = array("Duel Tournament""Bounty Hunters""Bounty Hunter Rogues""Fist of Guthix""Mobilising Armies");
        
    $parse["contents"] = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=" $parse["config"]["username"]);
        
    $parse["contents"] = explode("\n"$parse["contents"]);
        foreach (
    $parse["contents"] AS $k => $v)
        {
            if (!empty(
    $v))
            {
                if ((
    count($parse["contents"]) - count($parse["config"]["minigames"]) - 1) > $k)
                {
                    
    $parse["temp"] = explode(","$v);
                    echo(
    "<b>" $parse["config"]["skills"][$k] . "</b>: rank=" $parse["temp"][0] . "; level=" $parse["temp"][1] . "; xp=" $parse["temp"][2] . "<br />\n");
                }
                else
                {
                    
    $parse["temp"] = explode(","$v);
                    echo(
    "<b>" $parse["config"]["minigames"][$k-(count($parse["contents"]) - count($parse["config"]["minigames"]) - 1)] . "</b>: rank=" $parse["temp"][0] . "; score=" $parse["temp"][1] . "<br />\n");
                }
            }
        }
    ?>
    Note how the skills and minigames are arranged how they are in the high score list.
     
< Layout/Template | Need some on to make a website for free >

Users viewing this thread
1 guest


 
 
Adblock breaks this site