Jak pobrać źródło strony znajdującej sę na serwerze?
0
0
To mój drugi program z Javie (od 20 minut sie bawię):
try
{
URL url = new URL("http://7thguard.net/news.php?id=4682");
InputStream in = url.openStream();
BufferedInputStream bufIn = new BufferedInputStream(in);
for (;;)
{
int data = bufIn.read();
if (data == -1)
break;
else
System.out.print ( (char) data);
}
}
catch (MalformedURLException mue)
{
System.err.println ("Zlu URL");
}
catch (IOException ioe)
{
System.err.println ("I/O Error - " + ioe);
}
Minuta googlowania + kilka pisania