$params = array(); // get params from the command line args // $argv is a php super global variable for ($i = 1; $i < count($argv); $i++) { $it = explode("=", $argv[$i]); $params[$it[0]] = $it[1]; } unset($params['action']); unset($params['do']); } else { // No params found exit; } // Initialize owa $owa = new owa_caller(); if ($owa->isEndpointEnabled(basename(__FILE__))) { // setting CLI mode to true $owa->setSetting('base', 'cli_mode', true); // setting user auth $owa->setCurrentUser('admin', 'cli-user'); // run controller or view and echo page content $s = owa_coreAPI::serviceSingleton(); $s->loadCliCommands(); if (array_key_exists('cmd', $params)) { $cmd = $s->getCliCommandClass($params['cmd']); if ($cmd) { $params['do'] = $cmd; echo $owa->handleRequest($params); } else { echo "Invalid command name."; }