Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-type: application/json');
- ini_set("display_errors", false);
- $user = $_GET['user'];
- $arr = array("name"=>$user, "agent"=>"minecraft");
- $data = json_encode($arr);
- $ch = curl_init('https://api.mojang.com/profiles/page/1');
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($data))
- );
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- if(!($res = curl_exec($ch))) {
- echo('[cURL Failure] ' . curl_error($ch));
- }
- curl_close($ch);
- echo $res;
- $username = json_decode($res, true);
- echo 'UUID: ' . $username->profiles[0]->id;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement