Fetch Url Of A Site

2 comments - Post a comment

/* Java Program To Fetch The Url Of Any Site */

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

public class fetchUrl
{
public static void main(String args[])
{
try
{
if(args.length !=1)
{
System.out.println("Usage: java fetchUrl < URL such as http://www.javapgms.blogspot.com>");
System.exit(0);
}
System.out.println("Hello");
URL url = new URL (args[0]);
System.out.println("\n Fetching URL :" +args[0] +"\n");
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String strline;
while((strline = br.readLine())!=null)
{
System.out.println(strline);
}
br.close();
}
catch(MalformedURLException mue)
{
System.out.println("Unknown URL");
}

catch(IOException ioe)
{
System.out.println("IO Error");
}
}
}

 
This Post has 2 Comments Add your own!
Anonymous - November 11, 2009 at 9:56 PM

I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic

sbobet - January 29, 2012 at 1:17 PM

sip bro...langsung ke TKP..
mo cek harsbobetganya nih

Post a Comment