Thanks for that its worked a treat!
Finnished and working Code:
Code: Select all
<?php
$user = $_GET['user'];
$lines = file('http://hiscore.runescape.com/index_lite.ws?player=' . $user, FILE_IGNORE_NEW_LINES);
$skills = array('Overall', 'Attack', 'Defence', 'Strength', 'Constitution', 'Ranged', 'Prayer', 'Magic', 'Cooking', 'Woodcutting', 'Fletching', 'Fishing', 'Firemaking', 'Crafting', 'Smithing', 'Mining', 'Herblore', 'Agility', 'Thieving', 'Slayer', 'Farming', 'Runecrafting', 'Hunter', 'Construction', 'Summoning', 'Dungeoneering');
$activities = array('Duel Tournament', 'Bounty Hunters', 'Bounty Hunter Rogues', 'Fist of Guthix', 'Mobilising Armies', 'B.A Attackers', 'B.A Defenders', 'B.A Collectors', 'B.A Healers', 'Castle Wars Games');
echo '<table class="tablemain">'
.'<tr>'
.'<td class="mainheadercell" colspan="4">Skill Hiscores - ' . $user . ' </td>'
.'</tr>'
.'<tr>'
.'<td class="headercells">Skill</td>'
.'<td class="headercells">Rank</td>'
.'<td class="headercells">Level</td>'
.'<td class="headercells">Xp</td>'
.'</tr>';
$i = 0;
foreach($skills as $skill) {
$parts = explode(',', $lines[$i]);
$parts = array_map('number_format', $parts);
$parts = str_replace('-1', '--', $parts);
echo '<tr>'
.'<td class="cellmain"><img border="0" src="' . strtolower($skill) . '.gif"><br>' . $skill . '</td>'
.'<td class="cellmain">' . $parts[0] . '</td>'
.'<td class="cellmain">' . $parts[1] . '</td>'
.'<td class="cellmain">' . $parts[2] . '</td>'
.'</tr>';
$i++;
}
echo '</table><br>';
echo '<table class="tablemain">'
.'<tr>'
.'<td class="mainheadercell" colspan="3">Activity Hiscores - ' . $user . ' </td>'
.'</tr>'
.'<tr>'
.'<td class="headercells">Game</td>'
.'<td class="headercells">Rank</td>'
.'<td class="headercells">Score</td>'
.'</tr>';
foreach($activities as $activity) {
$parts = explode(',', $lines[$i]);
$parts = array_map('number_format', $parts);
$parts = str_replace('-1', '--', $parts);
echo '<tr>'
.'<td class="cellmain"><img border="0" src="' . strtolower($activity) . '.gif"><br>' . $activity . '</td>'
.'<td class="cellmain">' . $parts[0] . '</td>'
.'<td class="cellmain">' . $parts[1] . '</td>'
.'</tr>';
$i++;
}
echo '</table><br>';
?>
URL to working script (Use username HSA Jay if testing):
http://services.hintscape.net/highscores/
So id lke to say a huge thank you to AbraCadaver for all of his help. I hope someone else may be able to make use of this code or parts of it.
Thanks again!