Just visit https://random-token.xyz/LENGTH to receive your pseudo-random token!
wget https://random-token.xyz/LENGTH
$token = file_get_contents("https://random-token.xyz/LENGTH");
private static String fetchToken(int length) throws IOException {
URL url = new URL("https://random-token.xyz/" + length);
InputStreamReader inputStreamReader = new InputStreamReader(url.openStream());
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
StringBuilder tokenBuiler = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
tokenBuiler.append(line);
}
return tokenBuiler.toString();
}
- no token collision
- choice between upper-/lower-case, numbers or mix