Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Request

 
Tom Ben
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you connect to a web page from a application and have it enter information in the text fields and then submit the form?
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if I understand what you mean. I interpret your question like this: You want to submit information to a form on a webpage without actually having to go to the page using your browser.
Try checking the source of the html page and look at the <form> tag.
It should have a method and an action attribute, the action tells you whether HTTP GET or HTTP POST is being used and action tells you where, i.e. what url, the result will be sent to.
Then check the names of the different input components and then you can simply send a query sting attached to the url specified by the action attribute.
Example:
A form where you submit your first and last name.
<form method="GET" action="www.somewhere.dom/input">
<input type=textfield name=fname>
<input type=textfield name=lname>
<input type=submit name="OK">
</form>
Filling in your name and clicking 'OK' on a page containing the code above will result in this url:
http://www.somewhere.dom/input?fname=John&lname=Doe
I hope this was useful information for you
 
Tom Ben
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have the idea that I want put the form does POST. I wish it did a GET but does not.
 
Angus MacCuish
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you're using Java ? The HttpURLConnection class in the java.net package is what you're looking for. I use it regularly to Post data to servlets - the javadoc should tell you all you need to know.
Cheers
Gus
 
the_larch
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree it is possible using the HttpURLConnection but i think it is too simple. You cant handle timeout for instance. So write a socket that performs a POST instead
 
allen turner
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai
I am not sure if i should post this here. any way..
i want to make an application that can be used as a yahoo chat client and can i do that using java and if so how? i guess yahoo uses http for its chat
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic