I am trying this on xampp on my local computer, but I'm getting no response from the server:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://authserver.mojang.com/authenticate");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, true);
$output = curl_exec($ch);
curl_close($ch);
return $output;
You are forgetting the actual POST parameters.
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
Seems that the library won't send a valid request if that is not provided.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.