*/ require_once 'lib/err_quit.php'; // for fatal errors require_once 'lib/GinkClient.php'; // create a gink client $client = new GinkClient(); // check basic number of args if (count($argv) < 3) { $msg = "Lists trackers for user in gink-ws\n"; $msg .= "USAGE: php {$_SERVER['PHP_SELF']} user pass\n"; err_quit($msg, 1); } // read arguments list($junk, $user, $pass) = $argv; // get the gateway (it will have the registration_url) $goGateway = $client->token($user, $pass); if (!empty($goGateway->_error)) { var_dump($goGateway); err_quit("Error: could not get gateway\n", 2); } $liveUrl = $goGateway->live_url; // do an endless loop do { $goLive = $client->get($liveUrl); if (!empty($goLive->_error)) { var_dump($goLive); err_quit("Error: could not get Live Data\n", 3); } if (count($goLive->updates)) { printf("[%s] UPDATES:\n", date("Y-m-d H:i:s")); // read out the available trackers
* Explanation ************** * This script uses the PHP GinkClient to generate a token, then uses that token * in the automatic login page of the Infleet Portal v1.3 in combination with * that page's redirection feature to open the Live Tracking immediately using * the saved username & password in the gink.ini file */ $fnIni = './iframe-embed.ini'; if (is_readable($fnIni) && ($ini = @parse_ini_file($fnIni))) { if (empty($ini['username']) || empty($ini['password'])) { header("Content-type: text/plain", true, 500); die("INI file missing 'username' and 'password' combination"); } } require_once "lib/GinkClient.php"; $client = new GinkClient(); // get the Gateway Object using the token method, ensure we have token $goGateway = $client->token($ini['username'], $ini['password']); if (!empty($goGateway->_error)) { header("Content-type: text/plain", true, 500); die($goGateway->_error . "\n" . $goGateway->body); } else { if (empty($goGateway->token)) { header("Content-type: text/plain", true, 500); die("No token retrieved on Gateway?!?!"); } } // Use token in auto-login + redirection $nextPage = empty($ini['redirect']) ? "live.html" : $ini['redirect']; $url = sprintf("https://infleet.bornemann.net/v1.3/login.html?token=%s&redirect=%s", $goGateway->token, $nextPage); header("Location: {$url}", true, 307);