diff options
author | Filipp Lepalaan <f@0x00.co> | 2012-04-04 17:54:57 +0300 |
---|---|---|
committer | Filipp Lepalaan <f@0x00.co> | 2012-04-04 17:54:57 +0300 |
commit | 6d63303f496c1265c27d3007bae6d80cf853775d (patch) | |
tree | 25e10aa9228ec569f0a9148b4aeadfddb39fc30d /gsxcl2 | |
parent | 1682659a37c29820bc44e3e9646f0e99abbe0fd7 (diff) | |
download | gsxlib-6d63303f496c1265c27d3007bae6d80cf853775d.tar.gz gsxlib-6d63303f496c1265c27d3007bae6d80cf853775d.tar.bz2 gsxlib-6d63303f496c1265c27d3007bae6d80cf853775d.zip |
Lots of experimental changes
Diffstat (limited to 'gsxcl2')
-rwxr-xr-x | gsxcl2 | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -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); |