include("simple_html_dom.php"); // Including the html-parser
$urlEU = "http://nios.kr/sc2/eu/2v2r/hots/index.php"; // File to look for the EU rankings
$urlUS = "http://nios.kr/sc2/us/2v2r/hots/index.php"; // File to look for the US rankings
$htmlEU = file_get_html($urlEU); // parsing that url
$htmlUS = file_get_html($urlUS); // parsing that url
$linkki = array("http://us.battle.net/sc2/en/profile/5239730/1/ProTech/","http://eu.battle.net/sc2/en/profile/4507475/1/ProTech/"); // Array for players to look for (whose rankings we want)
$tuloksetEU = array(); // make the results in an array
$tuloksetUS = array(); // make the results in an array
$tauluEU = $htmlEU->find("table[id=ladderData] tr"); // Solve the rankings from the table
foreach ($tauluEU as $riviEU) {
if (in_array($riviEU->find("a", 0)->href,$linkki)) {
$tuloksetEU[] = "#" . $riviEU->find('td', 0)->innertext; // add # to all results
}
}
$tauluUS = $htmlUS->find("table[id=ladderData] tr"); // Solve the rankings from the table
foreach ($tauluUS as $riviUS) {
if (in_array($riviUS->find("a", 0)->href,$linkki)) {
$tuloksetUS[] = "#" . $riviUS->find('td', 0)->innertext; // add # to all results
}
}
$htmlEU->clear(); // Unset the $html variant to allow f5 to refresh data
unset($htmlEU);
$htmlUS->clear(); // Unset the $html variant to allow f5 to refresh data
unset($htmlUS);
echo join(", ", $tuloksetUS); // print the results in wanted style
echo " / ";
echo join(", ", $tuloksetEU); // print the results in wanted style
?>