Advertisement
3_2004-2005 Internet/ Browsers/ HTML #145415

Downloading Web Page HTML Example

This code demonstrates how to download the HTML source code from a specified web page and output it to the screen. Can be used to retrieve tags, or words, or peanut butter from web pages. Enjoy.

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
import java.net.*;
import java.io.*;
public class URL1
{
  public static void main(String[] args) throws Exception {
    URL url = new URL("http://www.coryvia.net");
    InputStream html = url.openStream();
    int c = 0;
    String a = "";
        
    while(c != -1) {
      a = "";
      c = html.read();
      
      if(c == (char)60) {
        while(c != (char)62) {
          a = a + (char)c;
          c = html.read();
        }
      }
      
      if(a == "") {}
      else
        System.out.println(a + ">");
    }
  }
}
Původní komentáře (3)
Obnoveno z Wayback Machine