How to fill out form data on a website

I am looking for developing an application that will receive user data from the user, go to the site, log in, return the values ​​on the web page, and then display them to the user on the phone.

Does java have this functionality? Maybe I need to use javascript? do these answers depend on the website i am trying to access?

In my head, I believe that I can simply read strings or characters in the parameters, analyze the web page for the appropriate form, and “insert” the corresponding value into the “window” field. However, I never tried to code something like this, so I am completely new to this idea and do not know where to start. I tried a Google search, but any information I found was either irrelevant or inconsistent.

I'm not looking for code to do this because I will not really learn from this, but a finger in the right direction would be great. I really want to try better programming, so I started giving myself these small side projects.

Any help that could be offered would be great

+1
source share
2 answers

Jan, you can try using the http-client (http://hc.apache.org/httpclient-3.x/) lib from apache. It allows you to program access to a website (from Java code). You will need to do the following:

  • Use http-client lib to send data to the website.
  • Get html response.
  • Use some html or xpath parser to extract values ​​from the html response.
+1
source

You will need a script that accesses the web page and enters the data, but in my opinion this is illegal. Because you gain access to a protected area and can view sensitive data. Also accessing the page through a script - "botting" - on most pages there are precautions to prevent scripts from running, because most of them are harmful. In my opinion, there is no legal and easy solution for this.

+1
source

Source: https://habr.com/ru/post/983522/


All Articles