views:

44

answers:

2

I've often wanted to create applications that provide a simpler front-end to other websites that require users to login before the pages I want to use can be accessed. I was wondering, if

(1) any website with a POST to an http page can be authenticated by POSTing

postField1name=pf1Value&postField2name=pf2Value

to the website, if that's true how can you inspect the HTML to POST correctly?

(2) I wanted to know if you could parse HTML, say for a sign up form, and display all the fields in an application UI, including downloading a Captcha, and displaying it to the user, and allowing them to type the value in, to send back to the website, and process the response.

Also if anyone knows how I might accomplish (2) using Apache HTTP Client in java, I'd greatly appreciate it!

http://hc.apache.org/httpcomponents-client/httpclient/index.html

A: 

(1) An easy way to find out what's actually being POST'd is to look at the actual HTTP requests. You can do that with a tool like LiveHTTPHeaders. Then have your script simulate that.

(2) Yes. You can use cURL, which is excellent for things like this.

quantumSoup
So for example, Their post method for captcha is actually to send what the user typed. I'm assuming they check it somehow against the captcha that was generated when the page was created. How do I make sure that will work?
Janine
@Janine Is this running on a server or the client?
quantumSoup
Client, connecting to third part server
Janine
So you are writing a client that acts like a web browser?
quantumSoup
Yes, I have a client with the same fields as the website, and POST and GET in the same manner. After using POST to authenticate with the site, one of the pages an authenticated user can see is one that displays a CAPTCHA and has a field which POSTs the user's entry. I want to be able to show the same Captcha to the user, so the correct "answer" is submitted
Janine
I used your suggestion LiveHTTPHeaders, which is great! Now I think all I will have to do is know that it is possible to do what I want with the CAPTCHA, before I begin this project
Janine
...So how could I do that?
Janine
A: 

(1) Try FireBug. There's actually a lot of options for authentication.

(2) Try JTidy

lexicore