discord php curl 登录失败
discord php curl login Fail
我想用 php curl 登录到 discord,但对我不起作用我的代码有什么问题我想自动登录到 discord 并从 html 获取数据 .. ..!
关闭
有几点建议:
1) 如果你想看一些回复的信息。你必须回显 $answer
。否则即使数据发送正确你也看不到响应。
2) 该网站使用了验证码。我尝试使用正确的 email/password 并得到以下响应 {"captcha_key": ["captcha-required"]}
。我不知道如何解决这个问题。也许你应该联系 Discord。
3) 该站点需要 json 数据。以下是我使用的代码:
<?php
$data = array("email" => "XXXX", "password" => "XXXX");
$data_string = json_encode($data);
$ch = curl_init('https://discordapp.com/api/v6/auth/login');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$answer = curl_exec($ch);
echo $answer;
if (curl_error($ch)) {
echo curl_error($ch);
}
?>
希望这会有所帮助。
我想用 php curl 登录到 discord,但对我不起作用我的代码有什么问题我想自动登录到 discord 并从 html 获取数据 .. ..! 关闭
有几点建议:
1) 如果你想看一些回复的信息。你必须回显 $answer
。否则即使数据发送正确你也看不到响应。
2) 该网站使用了验证码。我尝试使用正确的 email/password 并得到以下响应 {"captcha_key": ["captcha-required"]}
。我不知道如何解决这个问题。也许你应该联系 Discord。
3) 该站点需要 json 数据。以下是我使用的代码:
<?php
$data = array("email" => "XXXX", "password" => "XXXX");
$data_string = json_encode($data);
$ch = curl_init('https://discordapp.com/api/v6/auth/login');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$answer = curl_exec($ch);
echo $answer;
if (curl_error($ch)) {
echo curl_error($ch);
}
?>
希望这会有所帮助。