How to get the source code of web pages from Java
See English answers > How do you programmatically download a web page in java8
> http://www.cumhuriyet.com.tr?hn=298710 > http://www.fotomac.com.tr/Yazarlar/Olcay%20%C3%87ak%C4%B1r/2011/11/23/hesap -makinesi > http://www.sabah.com.tr/Gundem/2011/12/23/basbakan-konferansta-konusuyor#
My main problem is some code to retrieve the web page source code, but I lack some code For example, the following code does not work for the first link
InputStream is = fURL.openStream(); //fURL can be one of the links above BufferedReader buffer = null; buffer = new BufferedReader(new InputStreamReader(is,"iso-8859-9")); int byteRead; while ((byteRead = buffer.read()) != -1) { builder.append((char) byteRead); } buffer.close(); System.out.println(builder.toString());
Solution
This code works for me (sorry, variable name:)
The above is all the contents of how to obtain the source code of web pages from Java collected and sorted by programming house. I hope this article can help you solve the program development problems encountered in how to obtain the source code of web pages from Java.
If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.