<?php
// Simulate GET request
$_GET['op'] = 'listar';

// Capture output
ob_start();
require 'atencion.php';
$output = ob_get_clean();

// Check if output is valid JSON
$json = json_decode($output);

if ($json === null && json_last_error() !== JSON_ERROR_NONE) {
    echo "ERROR: Output is not valid JSON.\n";
    echo "JSON Error: " . json_last_error_msg() . "\n";
    echo "Raw Output:\n";
    echo "--------------------------------------------------\n";
    echo $output;
    echo "\n--------------------------------------------------\n";
} else {
    echo "SUCCESS: Output is valid JSON.\n";
    // echo "Output: " . substr($output, 0, 100) . "...\n";
}
?>