we are trying to make a website for our class, here you can see important news, the class schedule, homework schedule and a contact page for tips and bugs...
So, we want to have the schedule always up to date and a class mate made a api to get the schedule-data from our school site. but now we have an issue... he don't want to help us anymore!!! -,-
here is the question? The schedule is echo in a table but it stand next to eachother, because the api only separate the days including the lesson. but we want the lesson seperate from the day! and echo the table below each other..
Is there anyone who want to help me / Us out??? Link for a live previeuw how its now!
<?php
$apis = array('verandermij');
if (!isset($_GET['afdeling'])) //school sector
{
echo "FOUTCODE 1"; //Wrongcode
exit;
}
if (!isset($_GET['klas'])) // class
{
echo "FOUTCODE 2"; //Wrongcode
exit;
}
if (!isset($_GET['api']))
{
echo "FOUTCODE 3"; //Wrongcode
exit;
}
$apigeldig = false;
foreach ($apis as $api)
{
if ($api == $_GET['api'])
{
$apigeldig = true;
}
}
if ($apigeldig == false)
{
echo "FOUTCODE 4"; //Wrongcode
exit;
}
$afdeling = $_GET['afdeling'];
$klas = $_GET['klas'];
// get the class data
$url = "https://rooster.rocfriesepoort.nl/emmeloord.aspx?group=" . $afdeling . "&specs=" . $klas . "&a=1";
$content = file_get_contents($url);
// little bit cleaning
$content = explode("<div class=header>Rooster</div>", $content);
$content = $content[1];
// Splits dagen
$raw_dagen = explode("<td valign=top style='background-color: #e5e5e5'>", $content); //Raw_Days
$clean_dagen = array(); // Clean_Days
$dagen = array( //Days
$raw_dagen[1],
$raw_dagen[2],
$raw_dagen[3],
$raw_dagen[4],
$raw_dagen[5]
);
// Beginnen met sorteren
$opgeschoond = array(); //Cleand
$stoploop = false;
foreach ($dagen as $dag) //Days as Day
{
$tmp = explode("</div>", $dag);
$i = 0;
foreach ($tmp as $item)
{
if ($stoploop == true) { $i++; continue; }
if ($tmp[$i] == null) { $i++; continue; }
$tmp[$i] = str_replace("<div class='dagHeader'>", "", $tmp[$i]);
$tmp[$i] = str_replace("<div class=tablecell3>", "VRIJ", $tmp[$i]);
$tmp[$i] = str_replace("<div class=tablecell1>", "", $tmp[$i]);
$tmp[$i] = str_replace("<div class=tablecell2>", "", $tmp[$i]);
$tmp[$i] = str_replace('<br style="clear:both"></br><br><br><div id=footer style="width:95%;">© ROC Friese Poort 2015 - ', "", $tmp[$i]);
$tmp[$i] = str_replace("<a href='javascript:void(0)'". ' onclick="Disclaimer' . "('500','500','YES')" . '" title=' . "'Disclaimer'>", "", $tmp[$i]);
if ($tmp[$i] == "</td>")
{
$tmp[$i] = "DAG EINDE";
}
if ($tmp[$i] == "</td></table>")
{
$tmp[$i] = "DAG EINDE";
unset($tmp[$i + 1]);
unset($tmp[$i + 2]);
unset($tmp[$i + 3]);
unset($tmp[$i + 4]);
unset($tmp[$i + 5]);
unset($tmp[$i + 6]);
$stoploop = true;
}
$i++;
}
array_push($opgeschoond, $tmp);
}
print(json_encode($opgeschoond));
?>
this we use the echo the data!!!!!
<table>
<tr>
<?php
foreach ($maandag as $lesuur)
{
print("<td>");
print($lesuur);
print("</td>");
}
?>
</tr>
<tr>
<?php
foreach ($dinsdag as $lesuur)
{
print("<td id='oneven'>");
print($lesuur);
print("</td>");
}
?>
</tr>
<tr>
<?php
foreach ($woensdag as $lesuur)
{
print("<td>");
print($lesuur);
print("</td>");
}
?>
</tr>
<tr>
<?php
foreach ($donderdag as $lesuur)
{
print("<td id='oneven'>");
print($lesuur);
print("</td>");
}
?>
</tr>
<tr>
<?php
foreach ($vrijdag as $lesuur)
{
print("<td>");
print($lesuur);
print("</td>");
}
?>
</tr>
</table>
link for the raw data: enter link description here
[["Maandag 09-11-2015","MTM
Nederlands C2.02 ","MTM Nederlands A2.08 ","VRIJ","KAS Wiskunde B2.02 ","KSR SLB A2.07 ","DAG EINDE"],["Dinsdag 10-11-2015","VRIJ","CRL Database techn. A2.07 ","CRL Database techn. A2.07 ","CRL CMS A2.07 ","VRIJ","CRL CMS A2.07 ","CRL Webservers A2.07 ","CRL Webservers A2.07 ","DAG EINDE"],["Woensdag 11-11-2015","VRIJ","VRIJ","KSR Java Script A2.07 ","KSR Java Script A2.07 ","VRIJ","VRIJ","VSS Routeplanner B2.04 ","VSS LevO B2.04 ","VSS LLB B2.04 ","DAG EINDE"],["Donderdag 12-11-2015","VRIJ","KRJ Project A2.07 ","KRJ Project A2.07 ","KRJ Project A2.07 ","VRIJ","KSR Scrum A2.07 ","GFO Rekenen B2.01 ","KSR Scrum A2.07 ","DAG EINDE"],["Vrijdag 13-11-2015","ZAA Engels B2.03 ","ZAA Engels B2.06a ","KRJ Project A2.07 ","KRJ Project A2.07 ","VRIJ","KSR SLB A2.07 ","GFO Rekenen B2.06 ","DAG EINDE"]]
thanks for helping me, a beginner (a)