Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = 'https://authserver.mojang.com/authenticate/';
- $nono = array('\n');
- $nonoFix = array('');
- // LOGIN
- echo("Enter your username: ");
- $handle = fopen ("php://stdin","r");
- $username = str_replace($nono, $nonoFix, fgets($handle));
- echo("Enter your password: ");
- $password = str_replace($nono, $nonoFix, fgets($handle));
- // JSON
- $agent = array("name" => "Minecraft", "version" => 1);
- $object = array("agent" => $agent, "username" => $username, "password" => $password);
- // CURL
- $ch=curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($object));
- $result = curl_exec($ch);
- curl_close($ch);
- echo ("THE AMAZING RESULT ISSSS: " . $result);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement