include_once "transavia.php";
include_once "countrycode.php";
include_once "recepten.php";
include_once "Allerhande.php";
include_once "countrycolors.php";
include_once "huemanager.php";
include_once "bolmanager.php";
include_once "spotify.php";
include_once "schiphol.php";
//Getting those annoying notices and warnings out of the way
error_reporting(0);
// ini_set('display_errors', 1);
$flightId = $_REQUEST['flightId'];
$numberOfRecipes = $_REQUEST['numberOfRecipes'];
$airportCode = Transavia::getCountryCodeForJourney($flightId);
$countryCode = CountryCode::getCountryCodeForIATA($airportCode);
$fileName = "cache/cache.json." . $flightId . $numberOfRecipes;
$jsonObject = new StdClass();
if (file_exists($fileName)) {
    $jsonObject = json_decode(file_get_contents($fileName));
} else {
    $jsonObject->recepten = Recepten::getReceptenForCountry($countryCode, $numberOfRecipes);
    $jsonObject->colors->RGB = CountryColors::getMainColors($countryCode);
    $jsonObject->colors->HUE = CountryColors::array_RGB_TO_HUE($jsonObject->colors->RGB);
    $jsonObject->producten = BolManager::getProductsForCountry($search = Countries::getDutchName($countryCode));
    //$jsonObject->bagbeltNumber = Schiphol::getBagbeltNumber($journeyCode);
    $jsonObject->spotify = Spotify::getTrack($countryCode);
    foreach ($jsonObject->recepten as &$r) {
        $r->receptimagehd = Allerhande::getHighResImage($r->recepturl);
    }
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
include_once "transavia.php";
$fileName = "cache/cache.json.todaysFlights";
$cache = true;
$flightIds = array();
if (file_exists($fileName) && $cache) {
    $flightIds = json_decode(file_get_contents($fileName));
} else {
    $data = Transavia::getJourneysToKLM();
    foreach ($data as $flight) {
        $flightIds[] = $flight;
    }
    file_put_contents($fileName, json_encode($flightIds));
}
echo json_encode($flightIds);