selecting certain parts of a webpage
Posted: Sun Apr 27, 2003 10:55 am
hey
i am trying to parse the following site which contains rankings etc
http://www.runescape.com/hiscoreuser.cg ... urlen_borg
im not really sure about how to go about it, i have never parsed anything before
seeing as the values i want are incased in <font color=yellow>
some value<br>
</font>
ive managed to load the page as a file resource, $fp
my plan is to have
but hmmm that doesnt work.. any help ?
many thanks
i am trying to parse the following site which contains rankings etc
http://www.runescape.com/hiscoreuser.cg ... urlen_borg
im not really sure about how to go about it, i have never parsed anything before
seeing as the values i want are incased in <font color=yellow>
some value<br>
</font>
ive managed to load the page as a file resource, $fp
my plan is to have
Code: Select all
<?php
//// username config
$username = "gurlen_borg";
$webpage = "http://www.runescape.com/hiscoreuser.cgi?category=0&username=".$username;
$fp = fopen( $webpage, "r" ) or die("couldnt open $webpage");
$page = explode(' ', $fp); // split it into words
$word = count($page);
$i = 0;
while ($i <= $word) {
if ($page[$i] = "<font") {
/// i know the next value will be color=yellow>, and the one after the thing that i want
$rank = $page[$i+2];
/// etc...
}
$i++;
}
echo "your rank is ".$rank;
?>many thanks