Files
crm.twinpol.com/modules/EcmInvoiceOuts/test.php
Michał Zieliński e2fddb327c test python execute
2025-08-22 16:17:07 +02:00

17 lines
428 B
PHP

<?php
// Runs the Python script, waits for completion, and returns its output.
$cmd = 'python3 /var/www/html/modules/EcmInvoiceOuts/ai/test.py';
$output = [];
$returnVar = 0;
exec($cmd . ' 2>&1', $output, $returnVar);
if ($returnVar !== 0) {
http_response_code(500);
echo "Error running Python script:\n" . implode("\n", $output);
exit;
}
// Expect a single line with the count
echo trim(implode("\n", $output));