Проблема решена: D
$info = curl_init();
curl_setopt_array($info, array(
CURLOPT_URL => "https://discordapp.com/api/oauth2/token",
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
"grant_type" => "authorization_code",
"client_id" => $data['id'],
"client_secret" => $data['secret'],
"redirect_uri" => $data['redirect'],
"code" => $data["code"],
),
CURLOPT_RETURNTRANSFER => true,
));
$tinyresult = curl_exec($info);
if ($tinyresult == false) {
$tinyerror = curl_error($info);
} else {
$tinyerror = null;
$tinyresult = json_decode($tinyresult);
}
$httpcode = curl_getinfo($info, CURLINFO_HTTP_CODE);
curl_close($info);
return array(
"data" => $tinyresult,
"err" => $tinyerror,
"state" => $httpcode,
);