-1

i have some basic knowledge of java (made little programs to help everyday life) Now the thing is i want to make a program that posts offers on a site every 2-3 minutes. I have never done anything with java related to the internet and web pages and even after browsing the internet i am clueless. How would i go about setting up a connection to a certain page click a certain button on that page and then fill in 3 boxes with information and post the offer?

Here is what i have to click:

Button

Here is the form i have to fill in:

Form

Community
  • 1
  • 1
Adrien Pecher
  • 335
  • 1
  • 7
  • 14

2 Answers2

0

You have to learn a bit more about how HTML form works, but basically browser sends a POST request to the webserver with the values from the form.

Chrome's Developer Tools, Firefox's web developer toolbar has a functionality what can help you to discover what request is sent to the server when you post a single form. Of course you have to fill the values with your heart content

If you already know what content you want to send, you can post it relative easily, it is described well with examples in this StackOverflow answer https://stackoverflow.com/a/4206094/182474.

But I strongly recommend to discover how browsers works internally from the aspect of HTTP protocol, because it is a very useful knowledge if you want to develop tools that interacts with web APIs or simulate posting HTML forms.

Community
  • 1
  • 1
Gabor Garami
  • 1,245
  • 8
  • 26
  • I found HtmlUnit and i think that is what i need but i still struggle to grasp it. Do you have any knowledge about that? – Adrien Pecher Nov 12 '14 at 16:40
0

You could use java.awt.Robot class and make all this thinks =) you only need to write your manually action to the automated action =)

  1. move mouse on text
  2. write this...
  3. tab
  4. write this other..
  5. tab press enter
  6. wait N second

hope it helps! =)

Andrea Bori
  • 190
  • 2
  • 15