@@ -0,0 +1,1989 @@
+package net;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.net.HttpURLConnection;%0Aimport java.net.MalformedURLException;%0Aimport java.net.URL;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A%0Apublic class HttpPage %7B%0A%09public static String CODE_MODE = %22utf8%22;%0A%09%0A%09public static String getPageSource(String url_str)%7B%0A%09%09byte%5B%5D data = getPageRawSource(url_str);%0A%09%09%0A%09%09if(data == null)%7B%0A%09%09%09return %22%22;%0A%09%09%7Delse%7B%0A%09%09%09try %7B%0A%09%09%09%09return new String(data,CODE_MODE);%0A%09%09%09%7D catch (UnsupportedEncodingException e) %7B%0A%09%09%09%09System.out.println(%22%5BERROR%5D: Parse data error%22);%0A%09%09%09%09return %22%22;%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static byte%5B%5D getPageRawSource(String url_str)%7B%0A%09%09byte%5B%5D ret = null;%0A        %0A        //change string to URL%0A%09%09URL url;%0A%09%09try%7B%0A%09%09%09url = new URL(url_str);%0A%09%09%7Dcatch(MalformedURLException e)%7B%0A%09%09%09System.out.println(%22%5BERROR%5D: Bad URL String%22);%0A%09%09%09return null;%0A%09%09%7D%0A%09%09%0A%09%09// connect%0A%09%09HttpURLConnection httpurlconnection;%0A%09%09try%7B%0A%09%09%09httpurlconnection = (HttpURLConnection)url.openConnection();%0A%09%09%09httpurlconnection.addRequestProperty(%22Referer%22, url_str);%0A%09%09%09httpurlconnection.connect();%0A%09%09%7Dcatch(IOException e)%7B%0A%09%09%09System.out.println(%22%5BERROR%5D: Connect to %22 + url_str + %22 failed%22);%0A%09%09%09return null;%0A%09%09%7D%0A%09%09%09%0A%09%09// get data%0A%09%09try%7B%0A%09%09%09int responsecode = 0;%0A%09%09%09responsecode = httpurlconnection.getResponseCode();%0A%09%09%09if(responsecode == HttpURLConnection.HTTP_OK)%7B %0A%09%09%09%09InputStream is = httpurlconnection.getInputStream();%0A%09%09%09%09%0A%09%09%09%09List%3CByte%3E dataList = new ArrayList%3CByte%3E();%0A%09%09%09%09byte buf;%0A%09%09%09%09while((buf = (byte) is.read()) != -1)%7B%0A%09%09%09%09%09dataList.add(buf);%0A%09%09%09%09%7D%0A%09%09%09%09byte%5B%5D byteListData = new byte%5BdataList.size()%5D;%0A%09%09%09%09%0A%09%09%09%09int i = 0;%0A%09%09%09%09for(Byte data : dataList)%7B%0A%09%09%09%09%09byteListData%5Bi++%5D = data;%0A%09%09%09%09%7D%0A%09%09%09%09%0A%09%09%09%09ret = byteListData;%0A%09%09%09%7D   %0A%09%09%09if (httpurlconnection != null)%0A%09%09%09%09httpurlconnection.disconnect();%0A%09%09%7Dcatch(IOException e)%7B%0A%09%09%09System.out.println(%22%5BERROR%5D: Fetch data from %22 + url_str + %22 failed%22);%0A%09%09%09return null;%0A%09%09%7D%0A%09%09return ret;%0A%09%7D%0A%7D%0A

Create HttpPage.java