<?php

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type, Authorization");

header('Content-Type: application/json');

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: 0");

$documentRoot = realpath(__DIR__ . '/../..');
$logFile = $documentRoot . "/php/api/log_rhb.json";

//$logFile = '/var/www/vhosts/cst.cat/subdomains/pefir/httpdocs/php/api/log_rhb.json';

if (file_exists($logFile)) {
    $jsonContent = file_get_contents($logFile);
    echo $jsonContent;
} else {
    echo json_encode(['error' => 'File not found']);
}
?>

