| HOME | FORUM | INDICE |

download GetPaginaWeb.java

/*
    L'esempio mostra come prelevare il contenuto di una pagina WEB.

    Autore: Agosto 2009, Giovanni Iacobelli - http://www.iacosoft.com

*/


import java.net.*;
import java.io.*;

class GetPaginaWeb
{
    public static void main(String[] args)
    {
        try
        {
            String SitoUrl= "http://www.iacosoft.com";
            
            URL conn= new URL(SitoUrl);

            BufferedReader r= new BufferedReader(new InputStreamReader(conn.openStream()));
            
            String riga;
            //la pagina verrą stampata a video
            while((riga=r.readLine()) != null)
            {
                System.out.println(riga);
            }
            
            r.close();

        } catch(Exception e)
        {
            System.err.println(e);
        }
    }
}