View Single Post
  #2 (permalink)  
Old 05-20-2007, 12:58 PM
levent levent is offline
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
You can use URLConnection class.

Here is a sample code:

Code:
try { URL google = new URL("http://www.google.com/"); URLConnection googleConnection = google.openConnection(); DataInputStream dis = new DataInputStream(googleConnection.getInputStream()); String inputLine; while ((inputLine = dis.readLine()) != null) { System.out.println(inputLine); } dis.close(); } catch (MalformedURLException me) { System.out.println("MalformedURLException: " + me); } catch (IOException ioe) { System.out.println("IOException: " + ioe); }
If you have more advanced requirements, i recommend you to use Apache HTTPClient library.
Reply With Quote