Daarom volgende vraag wat doet onderstaande code?
<?php
function addSportaKalender($reeks, $officialName, $clubName){
$url = "http://lap.sporta.be/schrijftoegang/kalender_voan.php?s=47";
// build data for request
// $data_array = array('afdeling' => $reeks);
$data_array = array('afdeling' => $reeks, 'speeldag' => '0', 'club' => '0', 'ploeg' => '0');
// $data_array = array('afdeling' => '0', 'speeldag' => '0', 'club' => '0', 'ploeg' => '10455');
$data = http_build_query($data_array);
// load html
$html = str_get_html(do_post_request($url, $data));
$tables = $html -> find('table');
// get specific game table
$tableToUse = null;
foreach ($tables as $table) {
//echo $table;
$rows = $table -> find('tr');
if(count($rows) > 4){
// if(count($rows) > 6){
$tableToUse = $table;
break;
}
}
//echo '$tableToUse = '.$tableToUse;
if ($tableToUse) {
$rows = $tableToUse -> find("tr");
echo getTableHeaderKalender();
for($i = 5; $i < count($rows); $i++){
// for($i = 20; $i < count($rows); $i++){
//echo 'rij '.$i.'<br>';
$cells = $rows[$i] -> find('td');
// $cells = $rows[$i] -> find('td') or $cells = $rows[$i] -> find('th');
//if ($cells) {echo 'ok gevonden : '.$cells[2]->innertext;}
if ($cells and $cells[2]->innertext>'') {
if ($cells[5]->innertext==$officialName or $cells[6]->innertext==$officialName) {
if ($cells[5]->innertext==$officialName and $clubName>'') {$cells[5]->innertext=$clubName; }
else if ($cells[6]->innertext==$officialName and $clubName>'') {$cells[6]->innertext=$clubName; }
echo getTableRowKalender(false, $cells[0]->innertext, $cells[1]->innertext, $cells[2]->innertext, $cells[3]->innertext, $cells[4]->innertext, $cells[5]->innertext, $cells[6]->innertext, $cells[7]->innertext, $cells[8]->innertext, $cells[9]->innertext, $cells[10]->innertext);
}
} else {
$cells = $rows[$i] -> find('th');
$cells = $rows[$i] -> find('/tr');
}
}
echo getTableFooter();
}
}
?>