Project Description:
We need a simple php scraping function that returns an array as follows:
function getLeaderboards ( $p_source ) {
if ($p_source == "ladbrokes") {
$url = "http://poker.ladbrokes.com/monthly/mtt/";
}elseif($p_source=="bodog"){
$url="http://poker.bodoglife.com/tournaments/leader-board.jsp?type=month";
}
//scraping code goes here
//array is populated here based on the above scraping code
return $array ;
}
We will call the function as follows for testing purposes:
//ladbrokes call
$myresults=getLeaderboards("ladbrokes");
echo '<table><tr><td>Rank</td><td>Player ID</td><td>Chips</td></tr>';
foreach ($myresults as $item) {
echo '<tr><td>'.$item["rank"].'</td><td>'.$item["playername"].'</td><td>'.$item["score"].'</td></tr>';
}
echo '</table>';
//bodog call
$myresults=getLeaderboards("bodog");
echo '<table><tr><td>Rank</td><td>Player ID</td><td>Chips</td></tr>';
foreach ($myresults as $item) {
echo '<tr><td>'.$item["rank"].'</td><td>'.$item["playername"].'</td><td>'.$item["score"].'</td></tr>';
}
echo '</table>';
Please look at the http://poker.ladbrokes.com/monthly/mtt/ page carefully and note that Position corresponds to $item["rank"], Alias corresponds to $item["playername"] and Points corresponds to $item["score"].
Please note that on the http://poker.bodoglife.com/tournaments/leader-board.jsp?type=month page, Rank corresponds to $item["rank"], Screen Name corresponds to $item["playername"] and Points corresponds to $item["score"].
We're running php4.