<?php
foreach($_GET  as $key => $value){${$key}=trim($value);$_PARAMS[$key]=${$key};}  
foreach($_POST as $key => $value){${$key}=trim($value);$_PARAMS[$key]=${$key};}
include_once('lib_main.php');

echo '=====> HOLA ';
echo '<br>';

$javaFile = "../_java/p12_expire"; 
$outputCompile = shell_exec("javac -encoding UTF-8 $javaFile.java 2>&1");

if ($outputCompile){echo "Error al compilar Java:\n$outputCompile";}
else{echo "Compilación exitosa.\n";}
echo '<br>';
?>

<?php
$p12File = $public_path."_pk12/0915379374001_250302_1953.p12";
$password = "PTSA2018";
$classPath=$public_path."_java/";

$javaCommand = "java -cp  ".($classPath)." p12_expire "." ".escapeshellarg($p12File)." ".escapeshellarg($password)." ";
$output = shell_exec($javaCommand);

// Verificar si hay salida
if ($output) {
    echo "Fecha de expiración del certificado: " . trim($output);
} else {
    echo "Error al obtener la fecha de expiración.". trim($output);
}
?>
