Runescape Bits & Bytes https://www.rsbandb.com/forums/ |
|
Highscore Lookup https://www.rsbandb.com/forums/viewtopic.php?f=38&t=17813 |
Page 1 of 1 |
Author: | Perfect Idol [ September 22nd, 2005, 11:18 pm ] |
Post subject: | Highscore Lookup |
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; } |
Author: | Adbot [ September 22nd, 2005, 11:18 pm ] |
Post subject: | Register and login to get these in-post ads to disappear |
Author: | Shane [ September 23rd, 2005, 7:47 am ] |
Post subject: | |
We can't tell you how the grabber that we have works. Shane |
Author: | Perfect Idol [ September 23rd, 2005, 6:13 pm ] |
Post subject: | |
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 ![]() or b) know someone from Jagex personally... |
Author: | Jeff [ September 23rd, 2005, 8:50 pm ] |
Post subject: | |
Screen scraper, that'll be like a robot. RSBANDB is poor ![]() ![]() No. Defienatly not choice b. Choice a is far more possible ![]() |
Author: | Perfect Idol [ September 23rd, 2005, 10:05 pm ] |
Post subject: | |
Jeff wrote: Screen scraper, that'll be like a robot. RSBANDB is poor
![]() ![]() No. Defienatly not choice b. Choice a is far more possible ![]() 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 ![]() ![]() |
Page 1 of 1 | All times are UTC - 7 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |