w
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* API - Obtener logs del webhook
|
||||
* Fecha: 13 de noviembre de 2025
|
||||
*/
|
||||
|
||||
require_once '../config/config.php';
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: GET');
|
||||
header('Access-Control-Allow-Headers: Content-Type');
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
|
||||
$limit = $_GET['limit'] ?? 50;
|
||||
$offset = $_GET['offset'] ?? 0;
|
||||
|
||||
$logs = $db->fetchAll(
|
||||
"SELECT
|
||||
id,
|
||||
status_code,
|
||||
ip_address,
|
||||
created_at,
|
||||
SUBSTRING(request_body, 1, 100) as request_preview,
|
||||
SUBSTRING(response_body, 1, 100) as response_preview
|
||||
FROM webhook_logs
|
||||
ORDER BY created_at DESC
|
||||
LIMIT :limit OFFSET :offset",
|
||||
[
|
||||
'limit' => (int)$limit,
|
||||
'offset' => (int)$offset
|
||||
]
|
||||
);
|
||||
|
||||
echo json_encode($logs);
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log("Error in get_logs.php: " . $e->getMessage());
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'Error interno del servidor']);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user