
Cruel__Machine
Senior Member

Apr 26, 2005, 10:48 AM
Post #1 of 11
(1142 views)
Shortcut
|
|
PHP source for hiscore lookup
|
Can't Post
|
|
I like making code as compressed as possible. So don't expect lengthy commented code from me. If you have questions post them and I'll answer if I feel like it :P BTW, the key of this code is in the parse function. Took me like 90 minutes to write lol (mostly because it was midnight :P). And, depending on the config of ur server, you may have to adjust some of the numbers in the function. The number that you'd have to change would prolly be the "- 7". Because it works on my webserver now (obviously), but I tested it on my personal apache server on my comp and it didn't display the correct two characters.
<?php $handle = fopen("http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=".$_GET['name'],"r"); if($handle){ while (!feof($handle)) { $contents .= fread($handle, 8192);} fclose($handle);} function parse($skill){ return substr(strstr($GLOBALS['contents'], '>'.$skill.'<'), strrpos(substr(strstr($GLOBALS['contents'], '>'.$skill.'<'), 1, 90), "</td><td align=") - 7, 2);} echo parse(Attack).'|'.parse(Strength).'|'.parse(Defence).'|'.parse(Hitpoints).'|'.parse(Ranged).'|'.parse(Prayer).'|'.parse(Magic).'|'.parse(Cooking).'|'.parse(Woodcutting).'|'.parse(Fletching).'|'.parse(Fishing).'|'.parse(Firemaking).'|'.parse(Crafting).'|'.parse(Smithing).'|'.parse(Mining).'|'.parse(Herblore).'|'.parse(Agility).'|'.parse(Thieving).'|'.parse(Slayer).'|'.parse(Runecrafting);?> Link for sample page: http://vtforce.com/test/htmlparse.php?name=zezima (sorry for the stretching of the page, I couldn't fix :P)
EOP ___________________________ "If evolution were true, I'd have a self-lubricating hand." Programmers: http://Cruels.net
(This post was edited by Cruel__Machine on Apr 26, 2005, 10:51 AM)
|