在Jsoup

时间:2017-04-20 08:05:23

标签: json jsoup

您好我正在尝试使用requestPayload作为数据解析网络,即时尝试使用数据但我失败了,我不知道我是否正确,我不知道如何使用requestBody()。

可以使用requestBody()

的示例来解释某人

我的代码转换了415错误:

Response responsePostLogin = Jsoup
            .userAgent("Mozilla/5.0") //connect and read time
            .cookies(loginPageResponse.cookies())
            .followRedirects(true)
            .ignoreHttpErrors(true)
            .ignoreContentType(true)
            .referrer("URL/es/")
            //:authority:URL
            //.header("authority", "URL")
            //.header("accept", "Content-Type")
            //.header("charset", "UTF-8")
            //.header("accept", "application/json, text/javascript, */*; q=0.01")
            //.header("accept-encoding", "gzip, deflate, br")
            //.header("Connection", "keep-alive, Transfer-Encoding")

            //.header("Accept", "Content-Type")
            //.header("Content-Type", "text/plain,application/json, application/x-www-form-urlencoded")

            .data("email","myemail)
            .data("password","mypass")
            // connect and read time out
            .timeout(10 * 1000)


            .method(Method.POST)
            .execute();

如果我退缩

.header("Accept", "Content-Type")
.header("Content-Type", "text/plain,application/json, application/x-www-form-urlencoded") 

我有400错误。我不知道我该做什么。

当我检查网络时,我需要:

请求网址:网址

请求方法:POST

状态代码:201

远程地址:X.XX.XX.XX:XX

推荐人政策:no-referrer-when-downgrade

设置标题。

内容编码:gzip

内容语言:EN-US

内容长度:1067

内容类型:application / JSON;字符集= UTF-8

日期:XXXX

到期:XXX

杂注:无缓存

set-cookie:“cookies”

状态:201

变化:接受编码

X框选项:SAMEORIGIN

请求标题

:权威|地址

:方法| POST

:路径| / RestOfURL

:方案| HTTPS

接受| /

accept-encoding | gzip,deflate,br

接受语言| ES-ES,ES; Q = 0.8

内容长度| 68

内容类型|应用/ JSON

饼干| “曲奇”

原点| URL

引荐| URL / ES /

user-agent | Mozilla / 5.0(X11; Linux x86_64)AppleWebKit / 537.36(KHTML,与Gecko一样)Chrome / 57.0.2987.133 Safari / 537.36

查询字符串参数

languageId:-5

APPID:1

请求有效负载

{email:“myemail”,密码:“mypass”}

电子邮件: “myemail”

密码: “为mypass”

谢谢,抱歉我的英语是我的冷杉咨询

0 个答案:

没有答案
相关问题