What’s wrong in below Jsoup request in Java ? It’s always throwing 403.
response2 = Jsoup.connect(URL)
.timeout(MAX_TIMEOUT + (retry * MAX_TIMEOUT))
.userAgent(userAgentValue)
.header("Cookie", hardCodedCookieValue)
.header("Origin",
"https://www.valueresearchonline.com")
.header("Referer", "https://www.valueresearchonline.com/login/?site-code=VROL&target=%2F%3F&utm_source=home&utm_medium=vro&utm_campaign=desktop-profile-menu")
//.header("Host", "www.valueresearchonline.com")
.data("username", "[email protected]")
.data("password", "valid_pwd")
.method(Connection.Method.POST)
.ignoreContentType(true)
.execute();
Corresponding cURL is as below
curl 'https://www.valueresearchonline.com/login/?site-code=vrol&target=%2f%3f&utm_source=home&utm_medium=vro&utm_campaign=desktop-profile-menu'
-H 'accept: */*'
-H 'accept-language: en-US,en;q=0.9,de;q=0.8'
-H 'content-type: application/x-www-form-urlencoded; charset=UTF-8'
-H 'cookie: currency=INR; .......'
-H 'login_by: null'
-H 'origin: https://www.valueresearchonline.com'
-H 'priority: u=1, i'
-H 'referer: https://www.valueresearchonline.com/login/?site-code=VROL&target=%2F%3F&utm_source=home&utm_medium=vro&utm_campaign=desktop-profile-menu'
-H 'sec-ch-ua: "Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"'
-H 'sec-ch-ua-arch: "x86"'
-H 'sec-ch-ua-bitness: "64"'
-H 'sec-ch-ua-full-version: "126.0.6478.183"'
-H 'sec-ch-ua-full-version-list: "Not/A)Brand";v="8.0.0.0", "Chromium";v="126.0.6478.183", "Google Chrome";v="126.0.6478.183"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-model: ""'
-H 'sec-ch-ua-platform: "macOS"'
-H 'sec-ch-ua-platform-version: "11.5.2"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'
-H 'x-requested-with: XMLHttpRequest'
--data-raw 'username=vikram....%40gmail.com&password=NUKegc2A%2BJ3qEh6.....'
1