在jsoup中使用multipart / form-data有效负载

时间:2018-07-05 14:55:36

标签: java android jsoup

我正在尝试使用Jsoup(基本上自动执行职位申请流程)将发帖请求发送给monster.com

我可以登录并查看工作详细信息,但是“应用”按钮不起作用。

我怀疑这与使用多格式数据这一事实有关。我尝试了不同的方法,但不断收到“ http错误,无法获取url”异常 这是我的代码-

formData1.put("------WebKitFormBoundaryP2RPiDAAXphKnETC\n" +
                            "Content-Disposition: form-data; name=\"Rs.DiversityMember\"","false");
                    formData1.put("form-data; Rs.SearchableMember","true");
                    formData1.put("------WebKitFormBoundaryP2RPiDAAXphKnETC\n" +
                            "Content-Disposition: form-data; name=\"CoverLetter.SaveCoverLetter\"","false");

                    formData1.put("------WebKitFormBoundaryP2RPiDAAXphKnETC\n" +
                            "Content-Disposition: form-data; name=\"CoverLetter.CoverLetterTitle\"","false");
                    formData1.put("------WebKitFormBoundaryP2RPiDAAXphKnETC\n" +
                            "Content-Disposition: form-data; name=\"Di.GenderId\"","2");

                    formData1.put("------WebKitFormBoundaryP2RPiDAAXphKnETC\n" +
                            "Content-Disposition: form-data; name=\"Di.EthnicityId\"","10");
                    Connection.Response homePage1 = Jsoup
                            .connect("https://job-openings.monster.com/v2/job/apply?jobId=197598613")
                            .cookies(loginCookies)
                            .header("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundaryP2RPiDAAXphKnETC")
                            .header("Referer","https://job-openings.monster.com/v2/job/apply?jobId=197598613")
                            .header("Origin","https://job-openings.monster.com")
                            .data(formData1)
                            .followRedirects(true)
                            .validateTLSCertificates(false)
                            .method(Connection.Method.POST)
                            .userAgent(userAgent)
                            .timeout(5000)
                            .execute();

0 个答案:

没有答案