/ Published in: Java
Connects to a web page, reads in the content and strips whitespace.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
{ conn.setReadTimeout(5000); conn.setConnectTimeout(5000); byte[] buff = new byte[1024]; int read; while((read = in.read(buff)) != -1) out.write(buff, 0, read); return out.toString().replaceAll("[\\s]+", " "); }