EXECUTAR COMANDO $command"; return $texto; }; } function agiLogWrapper($logEnabled) { return function ($texto) use ($logEnabled) { if ($logEnabled) { $filename = str_replace('.php', '-log.txt', __FILE__); $fp = fopen($filename, 'a'); fwrite($fp, $texto); fclose($fp); } }; } // -------------------------------------------------------------------------------------------------------------------------------- $stdin = fopen('php://stdin', 'r'); $stdout = fopen('php://stdout', 'w'); $fgId = (isset($argv[1])) ? $argv[1] : ''; // DID $logEnabled = true; $isXampp = (file_exists('C:\xampp')); $appdir = dirname(__FILE__); chdir($appdir); date_default_timezone_set('America/Bahia'); $agientrada = new AGIEntrada( array( 'agiRunCmd' => agiRunCmdWrapper($stdin, $stdout), 'agiLog' => agiLogWrapper($logEnabled) ), array( 'fgId' => $fgId, 'logEnabled' => $logEnabled, 'isXampp' => $isXampp ) ); $agientrada->run(); fclose($stdin); fclose($stdout); exit();