Revision: 1785
Updated Code
at November 10, 2006 00:04 by whitetiger
Updated Code
package HttpGetIMGs; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; /* * * Fa una richiesta di connessione al web e scarica la pagina... */ public class RandomIMGs { private BufferedReader br; private OutputStreamWriter osw; private String data; private String line; private URL url; private URLConnection conn; public RandomIMGs() { try { url = new URL("http://flickr.com/photos"); conn = url.openConnection(); conn.setDoOutput(true); osw = new OutputStreamWriter(conn.getOutputStream()); data = URLEncoder.encode("start", "utf-8") + "=" + URLEncoder.encode("1", "utf-8"); osw.write(data); osw.flush(); br = new BufferedReader(new InputStreamReader(conn.getInputStream())); while((line = br.readLine()) != null) { System.out.println(line); } osw.close(); br.close(); } catch(MalformedURLException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } } public static void main(String[] args) { new RandomIMGs(); } }
Revision: 1784
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 9, 2006 23:55 by whitetiger
Initial Code
package HttpGetIMGs; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; /* * * Fa una richiesta di connessione al web e scarica la pagina... */ public class RandomIMGs { private BufferedReader br; private OutputStreamWriter osw; private String data; private String line; private URL url; private URLConnection conn; public RandomIMGs() { try { url = new URL("http://flickr.com/photos"); conn = url.openConnection(); conn.setDoOutput(true); osw = new OutputStreamWriter(conn.getOutputStream()); data = URLEncoder.encode("start", "utf-8") + "=" + URLEncoder.encode("1", "utf-8"); osw.write(data); osw.flush(); br = new BufferedReader(new InputStreamReader(conn.getInputStream())); while((line = br.readLine()) != null) { System.out.println(line); } osw.close(); br.close(); } catch(MalformedURLException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } } public static void main(String[] args) { new RandomIMGs(); } }
Initial URL
Initial Description
Initial Title
Python - getHTMLpage
Initial Tags
css, javascript, java, html, rails, ruby, web
Initial Language
Python