Reputation: 11
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;
Upvotes: 0
Views: 1498
Reputation: 9162
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.
Upvotes: 1