您的位置:首页 > 编程语言 > Java开发

java实现自动打开网页 自动提交数据

2012-02-17 11:08 489 查看
package common;

/**

* @author zhangfj @email yjia2009@yahoo.cn

* @date 2012-2-16 涓嬪崍07:21:55

*/

import java.io.*;

import java.net.URL;

import java.net.URLConnection;

public class getUrlContent {

/**

* @param args

*/

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/login?u=859480017@qq.com\"&\"p=\131211221" ;

Process p = Runtime.getRuntime().exec("cmd /c start " + strURL );

try {

p .waitFor();

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐