Last active
August 29, 2015 14:02
-
-
Save robot56/c7c6b0acfee648e2f0c2 to your computer and use it in GitHub Desktop.
name -> uuid through api.mojang.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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