public static String readPage(String url) throws MalformedURLException,
			IOException {
		int maxSize = 500000;

		URL u = new URL(url);
		URLConnection uc = u.openConnection();
		if (!uc.getContentType().startsWith("text"))
			return "";
		InputStream is = uc.getInputStream();
		BufferedReader br = new BufferedReader(new InputStreamReader(is));

		String s = "";
		String temp = "";
		Boolean firstLine = true;
		while (temp != null && s.length() < maxSize) {
			temp = br.readLine();
			if (temp != null) {
				if (!firstLine)
					s += "\n";
				else
					firstLine = false;
				s += temp;
			}
		}

		return s;
	}