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

View file

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

View file

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