Savor
[insert_php]
$Text = file_get_contents(”http://www.savor.fi/lounaslistat/vallila/”);
$Text = utf8_encode($Text);
$Text = preg_replace(”/<\/h3>/”, ””, $Text);
$Text = preg_replace(”/
/”, ””, $Text);
$Text = preg_replace(”/<\/h4>/”, ””, $Text);
$Maanantai = ”/
Maanantai(.*?)<\/div>/s”;
$Tiistai = ”/
Tiistai(.*?)<\/div>/s”;
$Keskiviikko = ”/
Keskiviikko(.*?)<\/div>/s”;
$Torstai = ”/
Torstai(.*?)<\/div>/s”;
$Perjantai = ”/
Perjantai(.*?)<\/div>/s”;
$Keskiviikko = ”/
Keskiviikko(.*?)<\/div>/s”;
$Torstai = ”/
Torstai(.*?)<\/div>/s”;
$Perjantai = ”/
Perjantai(.*?)<\/div>/s”;
$Perjantai = ”/
Perjantai(.*?)<\/div>/s”;
preg_match($Maanantai,$Text,$Maanantaiok);
preg_match($Tiistai,$Text,$Tiistaiok);
preg_match($Keskiviikko,$Text,$Keskiviikkook);
preg_match($Torstai,$Text,$Torstaiok);
preg_match($Perjantai,$Text,$Perjantaiok);
if (date(”l”) === ’Monday’) {
echo ”MAANANTAI ”;
echo $Maanantaiok[1];
}
elseif (date(”l”) === ’Tuesday’) {
echo ”TIISTAI ”;
echo $Tiistaiok[1];
}
elseif (date(”l”) === ’Wednesday’) {
echo ”KESKIVIIKKO ”;
echo $Keskiviikkook[1];
}
elseif (date(”l”) === ’Thursday’) {
echo ”TORSTAI ”;
echo $Torstaiok[1];
}
elseif (date(”l”) === ’Friday’) {
echo ”PERJANTAI ”;
echo $Perjantaiok[1];
}
else {
echo ”VIIKONLOPPU!”;
}
[/insert_php]