Yaoming
Yaoming

Reputation: 1

Log in to website using Jsoup

I'm trying to scrap a webpage for data but came across the problem of needing to log in.

Connection.Response loginForm = Jsoup.connect("http://www.rapidnyc.net/users/google_login")
        .method(Connection.Method.GET)
        .execute();

 Document document = Jsoup.connect("http://www.rapidnyc.net/users/google_login")
        .data("Email", "testEmail")
        .data("Passwd", "testPass")
        .... //other form data
        .cookies(loginForm.cookies())
        .post(); 

This gives me the org.jsoup.HttpStatusException: HTTP error fetching URL. Status=400

I used chrome developer tool to look at the Form data being posted but nothing I post works.

Upvotes: 0

Views: 51

Answers (1)

Joel Min
Joel Min

Reputation: 3457

1. Have you submitted ALL input fields? Including HIDDEN ones.

2. I see the website requires "captcha-box" authentication, which is to prevent web crawlers from logging in. I highly doubt you will be able to log in with your program.

I say the 400 status is coming from your program not being able to provide the value for "captcha" authentication.

Upvotes: 1

Related Questions