import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
public class sourceFetcher
{
public static String fetchSource(String s)
{
String line,code="";
try {
URL url = new URL("http://"+s);
String temp="";
BufferedReader reader=null;
try
{
reader = new BufferedReader(new InputStreamReader(url.openStream()));
while((line=reader.readLine())!=null)
{
code=code+"\n"+line;
}
reader.close();
}catch(Exception e){return "error";}
}catch(Exception e){ return "error";}
return code;
}
}
No comments:
Post a Comment