Ejemplo n.º 1
0
    }
}
$verbose = TRUE;
$keywordsDirectory = NULL;
$serverPort = NULL;
for ($i = 1; $i < $argvCount; $i++) {
    $arg = $argv[$i];
    if ($arg == '--quiet' || $arg == '-q') {
        $verbose = FALSE;
    } else {
        if (is_null($keywordsDirectory)) {
            $keywordsDirectory = $arg;
        } else {
            if (is_null($serverPort)) {
                $serverPort = $arg;
                if (!is_numeric($serverPort)) {
                    die('Port must be a number: ' . $serverPort . "\n");
                }
            } else {
                die('Superfluous argument: ' . $arg . "\n");
            }
        }
    }
}
$keywordStore = new KeywordStore($verbose);
$keywordStore->collectKeywords($keywordsDirectory);
$protocol = new RobotRemoteProtocol($verbose);
$protocol->init($keywordStore);
$server = new RobotRemoteServer($verbose);
$server->init($protocol);
$server->startOnPort($serverPort);
Ejemplo n.º 2
0
require './vendor/autoload.php';
$argvCount = count($argv);
if ($argvCount < 2) {
    die("Missing parameters: path to the keywords implementation in PHP\n");
} else {
    if ($argvCount > 2) {
        die("Too many parameters: only one parameter required\n");
    }
}
$keywordsDirectory = $argv[1];
$keywordStore = new KeywordStore();
$keywordStore->collectKeywords($keywordsDirectory);
$protocol = new RobotRemoteProtocol();
$protocol->init($keywordStore);
$server = new RobotRemoteServer();
$server->init($protocol);
$server->start(new DemoRequests(), new DemoResponses());
class DemoRequests
{
    private $requests = array('<?xml version="1.0"?>
		<methodCall>
		   <methodName>get_keyword_names</methodName>
		   <params>
		      </params>
		   </methodCall>', '<?xml version="1.0"?>
		<methodCall>
		   <methodName>stop_remote_server</methodName>
		   <params>
		      </params>
		   </methodCall>');