<?php
$url = "https://tecnotrack.com.ar/api/buque.php";
$datos = "25.50,2,12:30,BUQUE2024_SECRET_KEY_XYZ789";

echo "URL: $url\n";
echo "Datos: $datos\n\n";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $datos);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_VERBOSE, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);

curl_close($ch);

echo "HTTP Code: $httpCode\n";
echo "Response: " . htmlspecialchars($response) . "\n";
echo "Error: $error\n\n";

// Ver logs
$logFile = __DIR__ . '/logs/api.log';
echo "=== LOGS ===\n";
if (file_exists($logFile)) {
    echo htmlspecialchars(file_get_contents($logFile));
} else {
    echo "No existe logs/api.log";
}
?>