$userId = $argv[6]; } $jsonString = file_get_contents("https://trello.com/1/boards/" . $trelloboard . "?key=" . $trellokey . "&token=" . $trellotoken); $trelloObj = json_decode($jsonString); if (empty($trelloObj)) { printf($jsonString); printf('Unable to parse JSON response, is it valid? %s', json_last_error_msg()); die(1); } //initialize the client $client = new Client($server); $client->authentication('jsonrpc', $token); //verify that we can connect $projects = null; try { $projects = $client->getAllProjects(); } catch (RuntimeException $e) { $projects = null; //explicitly set it to null, to trigger an error } $users = $client->getAllUsers(); foreach ($users as $user) { if ($user['username'] == $userId || $userId == null) { $userId = $user['id']; } } if (!is_array($projects)) { echo 'Unable to fetch the list of projects, is the server url / token correct?' . PHP_EOL; die(1); } //variables