Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Highscore Lookup
PostPosted: September 22nd, 2005, 11:18 pm 
How does the highscore lookup in your calculators work?

I'm creating one for a browser-based world switcher currently in the works (http://world-switcher.atspace.com), but it uses a screen scraper in PHP. This seems innefficent and terribly prone to breaking.

Is there a better way?

My code is listed below...


Code:
   function screenScrapeRunescape($user_name) {
      $query="http://hiscore-web.runescape.com/aff/runescape/hiscorepersonal.cgi?username=".$user_name;
      $result=file($query);
      $one_liner="";
      if(sizeof($result)!=0) {
         foreach($result as $val) {
            $one_liner.=$val;
         }
      }
      $one_liner=preg_replace("/(<style.*\/style>)|(<script.*\/script>)/i","",$one_liner);
      $stripped_result=htmlentities(strip_tags($one_liner));
      $stripped_result=preg_replace("/login(.|\s)*$/i","",$stripped_result);
      $stripped_result=preg_replace("/^(.|\s)*xp(\s)*/i","",$stripped_result);
      $stripped_result=preg_replace("/(\n){1,10}/i","\n",$stripped_result);
      $stripped_result=preg_replace("/\&.*;/i","",$stripped_result);
      $stripped_result=preg_replace("/^\s+/","",$stripped_result);
      $stripped_result=preg_replace("/\s+$/","",$stripped_result);
      $stripped_result=preg_replace("/\n/","<br />\n",$stripped_result);
      $stripped_result=preg_replace("/<br \/>\n<br \/>/","",$stripped_result);
      $stripped_result=preg_replace("/(((Attack)|(Defence)|(Strength)|(Hitpoints)|(Overall)|(Ranged)|(Prayer)|(Magic)|(Cooking)|(Woodcutting)|(Fletching)|(Fishing)|(Firemaking)|(Crafting)|(Smithing)|(Mining)|(Herblore)|(Agility)|(Thieving)|(Slayer)|(Farming)|(Runecrafting))<br \/>\n((\d+(\,)?)*)<br \/>\n((\d+(\,)?)*)<br \/>\n((\d+\,?)*))/i","\n<div style=\"border:solid black 1px;background-color:#f0f0f0;margin:2px;padding:5px;\">\n<strong>$2</strong><br />\n<em>Rank</em>: $25<br />\n<em>Level</em>: $28<br />\n<em>Experience</em>: $31\n</div>\n",$stripped_result);
      return $stripped_result;
   }


Top
  
 
 Post subject: Register and login to get these in-post ads to disappear
PostPosted: September 22nd, 2005, 11:18 pm 

Joined: September 9th, 2004, 1:47am
Posts: 9047
Location: In your web browserz


Top
  
 
 Post subject:
PostPosted: September 23rd, 2005, 7:47 am 
Site Owner
Offline

Joined: September 9th, 2004, 9:26 am
Posts: 6991
Location: Wild Rose Country ca
RS Name: shane12088
RS Status: P2P
We can't tell you how the grabber that we have works.

Shane

_________________


Top
 Profile  
 
 Post subject:
PostPosted: September 23rd, 2005, 6:13 pm 
Shane wrote:
We can't tell you how the grabber that we have works.

Shane


Lol I'm assuming it uses a screen scraper then.

If not though, congratulations, you are either:

a) far smarter than me 8)
or
b) know someone from Jagex personally...


Top
  
 
 Post subject:
PostPosted: September 23rd, 2005, 8:50 pm 
Rsbandb Donor
User avatar
Offline

Joined: December 22nd, 2004, 12:51 am
Posts: 6391
RS Name: Stanley1943
RS Status: F2P
Screen scraper, that'll be like a robot. RSBANDB is poor :wink: 8)
No. Defienatly not choice b. Choice a is far more possible :P

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: September 23rd, 2005, 10:05 pm 
Jeff wrote:
Screen scraper, that'll be like a robot. RSBANDB is poor :wink: 8)
No. Defienatly not choice b. Choice a is far more possible :P


Believe me, no one would like to see that proved more than I, as long as a better method is shown.

Actually screen scrapers are *extremely* easy to make, as my above code demonstrates, yet very unreliable.

Edit: Actually, I should probably rephrase that anyhow. Option a) would make you a better coder than me... NO ONE is smarter ;) :P


Top
  
 
Display posts from previous:  Sort by  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to: