Top

PHP RuneScape Stats Parser


PHP Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  Oct 31, 2009
Last Updated  Nov 03, 2009
Tags  parser  php  runescape  stats 

Introduction

its a pretty basic parser but its my first go at PHP :)

Grab the Code

<?php
  $rsn=$_GET["rsn"];
  $stats=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","Duel Tournament","Bounty Hunters","Bounty Hunters Rougue","Fist Of Guthix","Mobilising Armies");
  $url="http://hiscore.runescape.com/index_lite.ws?player=".$rsn;
  $data=explode(chr(10),file_get_contents($url));
  $a="0";
  echo "<pre>Showing Stats for: ".$rsn."</br>";
  foreach ($data as &$value) {
    if ($a<29) {
      $value=str_replace(","," ",$value);
      echo $stats[$a].": ".str_replace("-1 -1","Not Ranked",str_replace("-1 -1 -1","Not Ranked",$value))."</br>";
    }
    $a++;
  }
  echo "Done</pre>";
?>

Comments

  (2)  RSS
^Neptune
Comments: 598
 
PHP Snippet:  PHP RuneScape Stats Parser
Posted on Nov 3, 2009 9:49 am
*melts*

I didn't think you could use file_get_contents on a URL like that.. imma go print out the arrays.
sunslayer
Comments: 266
 
PHP Snippet:  PHP RuneScape Stats Parser
Posted on Nov 3, 2009 3:35 pm
ye i find file_get_contents to be a lot easier then cURL/sockets

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom