aboutsummaryrefslogtreecommitdiffstats
path: root/gsxcl2
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@0x00.co>2012-04-04 17:54:57 +0300
committerFilipp Lepalaan <f@0x00.co>2012-04-04 17:54:57 +0300
commit6d63303f496c1265c27d3007bae6d80cf853775d (patch)
tree25e10aa9228ec569f0a9148b4aeadfddb39fc30d /gsxcl2
parent1682659a37c29820bc44e3e9646f0e99abbe0fd7 (diff)
downloadgsxlib-6d63303f496c1265c27d3007bae6d80cf853775d.tar.gz
gsxlib-6d63303f496c1265c27d3007bae6d80cf853775d.tar.bz2
gsxlib-6d63303f496c1265c27d3007bae6d80cf853775d.zip
Lots of experimental changes
Diffstat (limited to 'gsxcl2')
-rwxr-xr-xgsxcl255
1 files changed, 55 insertions, 0 deletions
diff --git a/gsxcl2 b/gsxcl2
new file mode 100755
index 0000000..83f1b41
--- /dev/null
+++ b/gsxcl2
@@ -0,0 +1,55 @@
+#! /usr/bin/env php
+<?php
+
+if (TRUE) {
+ error_reporting( E_ALL|E_STRICT );
+}
+
+require 'gsxlib.php';
+
+$opts = getopt( 's:u:p:r:e:m:q:f:d:' );
+
+$region = (isset($opts['r'])) ? $opts['r'] : 'emea';
+$format = (isset($opts['f'])) ? $opts['f'] : 'print_r';
+$environment = (isset($opts['e'])) ? $opts['e'] : null;
+
+$gsx = GsxLib::getInstance($opts['s'], $opts['u'], $opts['p'], $environment, $region);
+
+$api = $argv[7];
+$valid = false;
+
+$client = $gsx->getClient();
+$functions = $client->__getFunctions();
+
+if($argv[8] == 'list') {
+ print_r($functions);
+ exit();
+}
+
+foreach($functions as $f) {
+ if(strstr($f, $api)) {
+ $valid = true;
+ }
+}
+
+if(!$valid) {
+ exit(sprintf('Function "%s" is invalid', $api));
+}
+
+$params = json_decode($argv[8], TRUE);
+
+if($params === NULL) {
+ exit('Invalid params!');
+}
+
+$session = array('userSession' => array('userSessionId' => $gsx->getSessionId()));
+$req = "{$api}Request";
+
+if($api == 'CompTIACodes') {
+ $req = 'ComptiaCodeLookupRequest';
+}
+
+$request = array($req => array_merge($params, $session));
+$result = $client->$api($request);
+
+print_r($result);