- strpos: documentation ( source)
- explode: documentation ( source)
- libxml_use_internal_errors: documentation ( source)
<?php
$doc = new DOMDocument('1.0', 'UTF-8');
$teamName = 'RC Drachten';
// Ignore warnings.
libxml_use_internal_errors(true);
// load the string into the DOM (this is your page's HTML), see below for more info
$doc->loadHTMLFile ('http://www.resultservices.nl/rugby/overview.php?Page=SENIOR&LevelID=5&CompID=816');
// since we are working with HTML fragments here, remove <!DOCTYPE
$doc->removeChild($doc->firstChild);
// remove <html></html> and any junk
$table = $doc->getElementsByTagName('table');
//$doc->replaceChild($body->item(0), $doc->firstChild);
// echo the HTML (or desired portion thereof)
$schedule = $doc->saveXML($table->item(1));
// Seperate each team
$teams = explode ('</tr>',$schedule);
echo $teams[0]; // Html table
echo $teams[2]; // Table header
for ($i = 0;$i<count($teams);$i++)
{
// Check if this is the right team
$pos = strpos($teams[$i],$teamName);
if ($pos !== false)
{
echo $teams[$i];
}
}
?>