$api = new TokenpassAPI(); // get vars $source = $argv[1]; $destination = $argv[2]; $token = $argv[3]; $amount = $argv[4]; if (!$source) { throw new Exception("source is required", 1); } if (!$destination) { throw new Exception("destination is required", 1); } if (!$token) { throw new Exception("token is required", 1); } if (!$amount) { throw new Exception("amount is required", 1); } // check echo "promising {$source}, {$destination}, {$token}, {$amount}\n"; $result = $api->promiseTransaction($source, $destination, $token, $amount, time() + 3600); // handle error if ($result === false) { $error_string = $api->getErrorsAsString(); if ($error_string) { echo "ERROR: {$error_string}\n"; exit(1); } } // show the results echo "\$result: " . json_encode($result, 192) . "\n";