Try this
Thor HW

    try {

      URL url = new URL (_urlToRead);

      URLConnection uc = url.openConnection();

      InputStream content = (InputStream)uc.getInputStream();
      BufferedReader in =
        new BufferedReader (new InputStreamReader (content));
      String line;
      while ((line = in.readLine()) != null) {
        System.out.println (line);
        }
      }

    } catch (MalformedURLException e) {
      System.out.println ("Invalid URL");
      return false;

    } catch (IOException e) {
      System.out.println ("Error reading URL");
      return false;
    }

----- Original Message -----
From: Ravachol Pereira <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 06, 1999 3:01 AM
Subject: WebSpider, printing the contents of an URL


> Hi,
>
> I am lost in the jungle of urls, urlstreamhandlers and
contenthandlerfactories.
> What I am trying to do is simply to get the contents of an url (the html)
and
> printing it.
>
> If anyone has done this before, please send me some sample code.
>
> This is how far I've gotten:
> ===
> URL url = new URL(urlname);
>
> URLConnection conn = url.openConnection();
>
> conn.connect();
>
> String mime = conn.getContentType();
>
> ===
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to