Skip to content

Instantly share code, notes, and snippets.

@relrod
Created May 19, 2009 20:53
Show Gist options
  • Save relrod/114395 to your computer and use it in GitHub Desktop.
Save relrod/114395 to your computer and use it in GitHub Desktop.
<?php
$source = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=pcon2009");
// First, get each of them in an array. It's easy to do this using explode().
$list = explode("\n",$source); // Put each in an array
$l = array();
foreach($list as $line){ // Iterate through the $list array.
// This gets a little confusing...
// Every time we iterate through the $list array, we add
// an entry
$l[] = explode(",",$line);
}
foreach($l as $rows){ // I fail at naming variables ><
echo "Rank: ".$rows[0]."\n";
echo "Level: ".$rows[1]."\n";
echo "XP: ".$rows[2]."\n";
echo "-------------------------\n";
}
?>
# Some of the output:
PB15:~/Code/PHP ricky$ php pconscores.php
Rank: 146118
Level: 1669
XP: 24497035
-------------------------
Rank: 334374
Level: 80
XP: 1990580
-------------------------
Rank: 338232
Level: 76
XP: 1389865
-------------------------
Rank: 519279
Level: 80
XP: 1989988
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment