开发者

How to fill out form data on a website

开发者 https://www.devze.com 2023-03-20 17:49 出处:网络
I am looking to develop an app that will take login details from the user, go to a website, login, return values on the web page and then display them to the user on the phone.

I am looking to develop an app that will take login details from the user, go to a website, login, return values on the web page and then display them to the user on the phone.

Does java have this functionallity? Will I need to use javascript instead maybe? do these answers depend on the website that I am trying to access?

In my head I figure that I could just read in the pa开发者_Python百科ramaters as strings or chars, parse the webpage for the appropriate form and "paste" the appropriate value into the form "box". However, I have never attempted anything like this with coding so I am completely new to the idea and dont really know where to start. I tried googling around but any information that I found was either irrelevant or conflicting.

I'm not looking for the code to do it because I will not really learn anythig from that but a finger in the right direction would be great. I really do want to try get better at programming so that's why I've started to give myself these little side projects

Any help that can be offered would be great


Ian, You can try using http-client (http://hc.apache.org/httpclient-3.x/) lib from apache. It lets to pro grammatically access a website (from a Java code). You will need to do the following things

  1. Use the http-client lib to POST the data to the web site.
  2. Receive the html response.
  3. Use some html parser or xpath to retrieve the values from the response html.


You would need a script which accesses the webpage and enters the data, but in my opinion this is illegal. Because you are accessing a secured area and are able to look into sensitive data. Also accessing the page via a script is "botting" - most pages have safety precautions to prevent the execution of scripts, because most of them are harmful. In my opinion there is no legal and easy solution to this.

0

精彩评论

暂无评论...
验证码 换一张
取 消