Here you can find the source of getURL(String url)
public static String getURL(String url) throws IOException, MalformedURLException
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 Wolfgang Werner./*w ww. j a v a2 s . c o m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Wolfgang Werner - initial API and implementation and/or initial documentation *******************************************************************************/ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; public class Main { public static String getURL(String url) throws IOException, MalformedURLException { URLConnection conn = new URL(url).openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String result = in.readLine(); return result; } }