New monitors
This commit is contained in:
@@ -53,10 +53,26 @@ if ($http_status == 200) {
|
||||
|
||||
// Set the content type of the response to JSON
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Log debug information
|
||||
error_log("UptimeKuma API Response Status: $http_status");
|
||||
error_log("Parsed monitors count: " . count($data));
|
||||
|
||||
// Output the data in JSON format
|
||||
echo json_encode($data, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
// Log the error
|
||||
error_log("UptimeKuma API Error: HTTP Status Code: $http_status");
|
||||
error_log("Response: " . substr($response, 0, 500));
|
||||
|
||||
// Set the content type of the response to JSON
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Output an error message if the request was not successful
|
||||
echo "Failed to fetch data. HTTP Status Code: $http_status";
|
||||
echo json_encode([
|
||||
'error' => true,
|
||||
'message' => "Failed to fetch data. HTTP Status Code: $http_status",
|
||||
'data' => []
|
||||
], JSON_PRETTY_PRINT);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user