I'm to write a Java program, which in part, parses 200 unique pages that require the user to log in beforehand. I've used Chrome's developer console to determine my specific login URL(https://r.espn.go.com/members/v3_1/login), verify that the login process used a POST request, and the Form Data names for both my username (username) and password (password). When using the method specified by the author of this post to retrieve a SESSIONID cookie for subsequent requests the returned headers were vastly different and no cookies were returned.
I've also tried the following snippet which uses both Jsoup and Apache's HttpClient, HttpPost, and HttpResponse which returns the loginpage:
MultipartEntity entity = new MultipartEntity();
entity.addPart("username", new StringBody(myUsername));
entity.addPart("password", new StringBody(myPassword));
HttpPost post = new HttpPost(url);
post.setEntity(entity);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(post);
String html = EntityUtils.toString(response.getEntity());
Document document = Jsoup.parse(html, url);
Every example I've read have a login url with a .php suffix, does this method only work with a PHP based login service? Or am I doing something fundamentally wrong?
Thanks!