PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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
<?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;
?>
but hmmm that doesnt work.. any help ?
many thanks
thanks for reply:)
after a bit of farting around, i finally got it to work
i split it into words and removed the <'s and >'s and exploded it all
here is code for those who are interested