nouveau-theatre-de-besancon/site/config/routes/mapado-fetch.php
2024-09-04 14:05:22 +02:00

25 lines
No EOL
594 B
PHP

<?php
return [
'pattern' => '/mapado-fetch.json',
'method' => 'POST',
'action' => function() {
$jsonRequest = file_get_contents("php://input");
$request = json_decode($jsonRequest, true);
$requestUrl = $request['requestUrl'];
$token = site()->mapadoToken();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $requestUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . $token
]);
$responseString = curl_exec($ch);
curl_close($ch);
return $responseString;
}
];