This question already has answers here:
Using Java to pull data from a webpage?
(5 answers)
Closed 5 years ago.
Can anyone suggest me a way to retrieve contents on a web page page using java?
I need to redirect to a web page, expand a block, and copy certain strings under it. Now I need to feed part of that string into another text box on a different page. How can this be done using java?
You should use Selenium (http://www.seleniumhq.org/). You can look up a tutorial on how to properly implement it for pulling data from websites. Assuming this is your own website, however, you can use a Socket.IO connection to communicate data.
Have you looked at Jsoup? https://jsoup.org/ it is a nice library for getting documents, parsing, etc.
Related
This question already has answers here:
Parsing JSON from URL
(8 answers)
Closed 8 years ago.
I have a web service exposed to me which returns a json object.
I've been provided with a url http://address.to.web.service:8080/game
If enter this in any browser i get a json output.
In my code, I've already implemented logic to populate a web page but using a local json file.
I now need to wire it up with the output of the web service.
Can someone help me understand what might be the simplest way to go for this problem?
You need to connect to your webservice, read the full response and convert it to a JSON array. You do not specify which part of the problem you're having problems with.
This question already has answers here:
How to consume REST in Java [duplicate]
(11 answers)
Closed 8 years ago.
Now I am forming the URL in the browser, and execute it via REST api like
localhost:9043/api/json?apiKey=699cccc3dcfb348fd369e083bcd7f2a4&Severity=all
and will get some JSON Object output.
Instead of working on browser, I need to give the URL in the java code itself and to get the json object output also in java code itself. I have searched but not found yet. Need some experts answer for my question.
it's just an HTTP call like any other, so you call it like any other HTTP call from a Java application, and get the results from that call like that as well.
So look up HttpURLConnection and go from there.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I make a raw HTTP request in Java?
I am monitoring a website which updates transaction data every few seconds, so for having better performance I need to store those data and analyze them (like plotting, etc.).
My question is how I can make a request to that server by Java EE and get the values which are available in a table in that site?
I should add that I do not search a solution by .net or php, and I have tried by JQuery, java HTTPRequest but I did not found the solution.
Any idea will be appreciated.
If they provide some sort of API/webservice that is best way to communicate,
if not and if the source site doesn't have any issue with the data you are taking from them you could use HTTP requests to get HTML response and parse the portion you want using JSoup
Have you actually tried anything yourself yet? SO is not a code generation tool.
That being said, this seems to be of interest: How do I make a raw HTTP request in Java?
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Send email using java
Need to send e-mails to users.. must have the capability of typing in email id or search using contacts.. sending normal emails by filling up recepient id would also do.. need the jsp codes and library file if used..
There's a whole API for that, take a look at the documentation for JavaMail.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Using java to create a web browser
Is there any way to make a webbrower using java?.
if yes pls give the idea about it.
Of course you can make a webbrowser by using java.
You would have to parse the html content of the pages you request.
If you're not interested in creating your own browser, here is a link how to display simple html files.