Skip to content

Instantly share code, notes, and snippets.

@Plastix
Created December 30, 2013 17:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Plastix/8184735 to your computer and use it in GitHub Desktop.
Save Plastix/8184735 to your computer and use it in GitHub Desktop.
PHP script used for checking the availability of Minecraft usernames. Requires a text file called names.txt in the same directory as the script with one name per line. Available names are saved to available_names.txt.
<?php
// Checks the availability of Minecraft usernames given a text file of names
$names = Array();
$input = "./names.txt"; //Names to be checked (one per line)
$output= "./available_names.txt"; //Available names
$names = file($input, FILE_IGNORE_NEW_LINES);
if(file_exists($output)) file_put_contents($output, "");
foreach( $names as $name ) {
$response = file_get_contents('https://account.minecraft.net/buy/frame/checkName/' . $name);
echo $response . " - " . $name . "\n";
if($response == "OK") file_put_contents($output, $name . "\n", FILE_APPEND | LOCK_EX);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment