#! /usr/bin/env php
".htmlentities($reply)."");
return array($r, null);
}
function handle_submit() {
global $argc, $argv;
if ($argc != 4) usage();
$seq = file_get_contents($argv[2]);
if ($seq === false) {
die("Can't read sequence file ".$argv[2]."\n");
}
$auth = $argv[3];
$req_xml = "
submit
$auth
";
list($reply, $errmsg) = do_http_op($req_xml);
if ($errmsg) die("Error: $errmsg\n");
$id = (int)$reply->id;
echo "batch ID: %d\n";
}
function handle_abort() {
global $argc, $argv;
if ($argc != 4) usage();
$batchid = $argv[3];
$auth = $argv[4];
$req_xml = "
abort
$batchid
$auth
";
list($reply, $errmsg) = do_http_op($req_xml);
if ($errmsg) die("Error: $errmsg\n");
echo "success\n";
}
function handle_status() {
global $argc, $argv;
if ($argc != 4) usage();
$batchid = $argv[3];
$auth = $argv[4];
$req_xml = "
status
$batchid
$auth
";
list($reply, $errmsg) = do_http_op($req_xml);
if ($errmsg) die("Error: $errmsg\n");
}
function handle_get_output() {
global $argc, $argv;
if ($argc != 4) usage();
$batchid = $argv[3];
$auth = $argv[4];
$req_xml = "
get_output
$batchid
$auth
";
list($reply, $errmsg) = do_http_op($req_xml);
if ($errmsg) die("Error: $errmsg\n");
}
function handle_retire() {
global $argc, $argv;
if ($argc != 4) usage();
$batchid = $argv[3];
$auth = $argv[4];
$req_xml = "
retire
$batchid
$auth
";
list($reply, $errmsg) = do_http_op($req_xml);
if ($errmsg) die("Error: $errmsg\n");
}
if ($argc < 2) usage();
switch ($argv[1]) {
case "submit": handle_submit(); break;
case "abort": handle_abort(); break;
case "status": handle_status(); break;
case "get_output": handle_get_output(); break;
case "retire": handle_retire(); break;
default: usage();
}
?>