PHP code example of bert-w / runescape-hiscores-api
1. Go to this page and download the library: Download bert-w/runescape-hiscores-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bert-w / runescape-hiscores-api example snippets
// OSRS
$hiscores = new \BertW\RunescapeHiscoresApi\OSRSHiscores([
'headers' => [
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
],
]);
// RS3
$hiscores = new \BertW\RunescapeHiscoresApi\RS3Hiscores([
'headers' => [
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
],
]);
$player = $hiscores->player('someplayer');
$skills = $player->skills();
// Only available for OSRS:
$minigames = $player->minigames();
// Case insensitive skill or minigame search. To be certain, use the
// exact name as used on the OSRS Hiscores page.
$player->get('agility')->level;
$player->get('Clue Scrolls (all)')->rank;
// Returns a \BertW\RunescapeHiscoresApi\HiscoreRow object.