不和谐的PHP卷曲登录失败 [英] discord php curl login Fail

查看:86
本文介绍了不和谐的PHP卷曲登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用php curl登录到discord,但是对我来说不起作用,我的代码有什么问题,我想自动登录到discord并从html抓取数据....!
已克隆

i want to login into discord with php curl but did't work's for me what is the problem in my code i want auto-login into discord and grab data from html ....! cloed

推荐答案

有一些建议:

1)如果您想查看一些响应的信息。您必须回显 $ answer 。否则,即使数据已正确发送,您也看不到响应。

1) If you want to see some responsed information. You have to echo $answer. Otherwise you couldn't see the response even the data were sent correctly.

2)该网站使用了验证码。我使用正确的电子邮件/密码尝试了此操作,并得到以下响应 { captcha_key:[ captcha-required]} 。我不知道如何解决这个问题。

2) The site used captcha. I tried it with correct email/password and get the following response {"captcha_key": ["captcha-required"]} . I have no idea how to round this. Maybe you should contact the Discord.

3)该站点需要json数据。这是我使用的代码:

3) The site requires json data. Here are the codes I used:

<?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卷曲登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆