天天看點

java送出網頁_java實作自動打開網頁 自動送出資料

package common;

import java.io.*;

import java.net.URL;

import java.net.URLConnection;

public class getUrlContent {

public static void main(String[] args) throws IOException{

// TODO Auto-generated method stub

test();

}

public static void test()throws IOException{

//  URL url=new URL("http://localhost:7001/login.jsp");

//  Object obj = url.getContent();

//  InputStream in=(InputStream) obj;

//        byte[]tt=new byte[in.available()];

//        int z;

//        while((z=in.read(tt, 0, tt.length))!=-1){

//         System.out.println(new String(tt,"utf-8"));

//        }

// System.out.println(obj.getClass().getName());

// String strURL = "http://localhost:7001/Login.do?usercode=system\"&\"password=" ;

String strURL = "http://ptlogin2.qq.com/[email protected]\"&\"p=\131211221" ;   Process p = Runtime.getRuntime().exec("cmd /c start " + strURL );   try {    p .waitFor();   } catch (InterruptedException e) {    // TODO Auto-generated catch block    e.printStackTrace();   }  } }