Catch all api script output/warnings

This commit is contained in:
Jay Trees 2022-03-11 15:58:42 +01:00
parent 05124129b5
commit 43e1c4e01b
3 changed files with 12 additions and 0 deletions

View file

@ -11,6 +11,8 @@ $response = array(
'success' => false,
);
ob_start();
require '../../index.php';
switch ($_SERVER['REQUEST_METHOD']) {
@ -48,6 +50,8 @@ switch ($_SERVER['REQUEST_METHOD']) {
break;
}
$response['warning'] = ob_get_clean();
header('Content-type: application/json; charset=utf-8');
echo json_encode($response);
die();

View file

@ -13,6 +13,8 @@ $response = array(
'success' => false,
);
ob_start();
require '../../index.php';
switch ($_SERVER['REQUEST_METHOD']) {
@ -28,6 +30,8 @@ switch ($_SERVER['REQUEST_METHOD']) {
break;
}
$response['warning'] = ob_get_clean();
header('Content-type: application/json; charset=utf-8');
echo json_encode($response);
die();

View file

@ -13,6 +13,8 @@ $response = array(
'success' => false,
);
ob_start();
require '../../index.php';
switch ($_SERVER['REQUEST_METHOD']) {
@ -87,6 +89,8 @@ switch ($_SERVER['REQUEST_METHOD']) {
break;
}
$response['warning'] = ob_get_clean();
header('Content-type: application/json; charset=utf-8');
echo json_encode($response);
die();