Skip to content

Instantly share code, notes, and snippets.

@robot56
Last active August 29, 2015 14:02
Show Gist options
  • Save robot56/c7c6b0acfee648e2f0c2 to your computer and use it in GitHub Desktop.
Save robot56/c7c6b0acfee648e2f0c2 to your computer and use it in GitHub Desktop.
name -> uuid through api.mojang.com
<?php
// insert paid usernames here (duh)
$name = ["jeb_", "notch"];
$game = "minecraft";
$api = "https://api.mojang.com/profiles/";
// request options
$opts = stream_context_create(['http'=>['method'=>'POST','header'=>'Content-type: application/json','content'=>json_encode($name)]]);
$request = json_decode(file_get_contents($api.$game, false, $opts), true);
if (empty($request)) {
printf("user not found: %s", $name);
exit;
}
foreach($request as $profile){
printf("username: %s -- uuid: %s\n", $profile["name"], $profile["id"]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment