Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Petter Kjelkenes  >  Runescape Tools  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example usage
Class: Runescape Tools
Create accounts and retrieve Runescape game data
Author: By
Last change: Added XP to next level
Date: 2010-06-02 18:30
Size: 2,095 bytes
 

Contents

Class file image Download
<?php

// Require class file....
require_once('runescape.class.php');

// Create the Runescape object.
$RS = new Runescape();




// Gets the highscore of Zezima.
$Zezima $RS->HighScore()->Name('Zezima');
echo 
"<h1>Zezima's CombatLevel: ".$Zezima['combatlevel']."</h1>";

echo 
"<h1>Zezima's Highscore data</h1><table><tr><td>Skill</td><td>Level</td><td>XP</td></tr>";
foreach(
$Zezima['stat'] as $stat){
    echo 
"<tr><td>".$stat['skill']."</td><td>".$stat['level']."</td><td>".$stat['xp']."</td></tr>";
}
echo 
"</table>";

echo 
"<h2>Zezima's Activity</h2><table><tr><td>Game</td><td>Rank</td><td>Score</td></tr>";
foreach(
$Zezima['activity'] as $activity){
    echo 
"<tr><td>".$activity['game']."</td><td>".$activity['rank']."</td><td>".$activity['score']."</td></tr>";
}
echo 
"</table>";

echo 
"<h1>Zezimas XP to next level in dungeoneering : ".$RS->Calculator()->getXpToLevel($Zezima['stat'][25]['xp'])."</h1>";






// Now print out top Overall:
$TopOverall $RS->HighScore()->Top();

echo 
"<h1>Top Overall Stats</h1><table><tr><td>Name</td><td>Level</td><td>XP</td></tr>";
foreach(
$TopOverall as $person){
    echo 
"<tr><td>".$person['name']."</td><td>".$person['level']."</td><td>".$person['xp']."</td></tr>";
}
echo 
"</table>";





// Now print out top Attack:
$TopAttacks $RS->HighScore()->Top(1); // Notice "1" as argument, it refers to the ID, Check the class for available ids... "2" equals defence... and so on..

echo "<h1>Top Attack Stats</h1><table><tr><td>Name</td><td>Level</td><td>XP</td></tr>";
foreach(
$TopAttacks as $person){
    echo 
"<tr><td>".$person['name']."</td><td>".$person['level']."</td><td>".$person['xp']."</td></tr>";
}
echo 
"</table>";









// News
$News $RS->News();

echo 
"<h1>Latest News From runescape.com</h1><table><tr><td></td></tr>";
foreach(
$News as $item){
    echo 
"<tr><td><h2><a href='".$item->link."'>".$item->title."</a></h2><p><small>".$item->pubDate.", ".$item->category."</small></p><p>".$item->description."</p></td></tr>";
}
echo 
"</table>";






?>