String urlstring="http://member.ecplaza.net/auth.do?MemberID=tradediscovery1&Password=123456&action=login&rurl=http://www.ecplaza.net/InquiryBox/InquiryBox.do?subject=new year&comments=tttttttttttttttttttttttt&mode=RFQ&id=1894977&clickfrom=M&cmd=send&ConfirmCD=
";
URL url=new URL(urlstring);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();  
InputStreamReader inputStream=new InputStreamReader(connection.getInputStream());
BufferedReader buffRead=new BufferedReader(inputStream);

解决方案 »

  1.   

    //package welcome;
    /**
     * <p>Title: </p>
     * <p>Description: </p>
     * <p>Copyright: Copyright (c) 2004</p>
     * <p>Company: </p>
     * @author not attributable
     * @version 1.0
     */
    import java.io.*;
    import java.net.*;
    public class Turl {  public static void main(String[] args) {try {
         StringBuffer strFileInfoBuf = new StringBuffer();
         String strProcessURL="http://211.137.137.204/cd/m.php?num1=2&num2=4&smstxt=Hello!username=hss&password=hde"; 
         URL objURL = new URL(strProcessURL);
         URLConnection objConn = objURL.openConnection();
         objConn.setDoOutput(true); 
         StringBuffer strTempBuf = new StringBuffer();
         byte[] byteArray = new byte[2048];
         int nReadCount = -1;
         BufferedOutputStream objOutput =new BufferedOutputStream(objConn.getOutputStream());
         FileInputStream objFileIn = new FileInputStream("d:\\test.txt");
         while ((nReadCount = objFileIn.read(byteArray)) != -1) {
              objOutput.write(byteArray, 0, nReadCount);
         }
         objOutput.flush();
         objFileIn.close();
         objOutput.close(); } 
     catch (Exception e) {
         e.printStackTrace();
    }  }
    }
    请问我错在哪里呢?
      

  2.   

    你不是想读取网页吗?应该是从HttpConnection中获取InputStream,然后建立一个OutputStream,把读入流的内容通过输出流写到本地文件test.txt中。