出人命了,老板发飚了,编不出来饭碗就丢了啊! 直接用URL类来实现。Apache的HttpClient也可以完成 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 做个页面,把request用隐藏的变量保存起来直接发送请求不行吗? 就是类似论坛那种输入一次,第二次 不用输入的吧,COOKIE cookie而且浏览器中必须将cookie打开 存到request的attribus里就行了,或者做个自动提交用户名密码的页面也行啊 听得不是很懂,既然你知道用户名和密码了,就直接用<input type=hidden name="username" vlaue="小王"><input type=hidden name="password" vlaue="密码">传给下一页就可以了不知道是不是你想表达的意思 url?name=str&psw=***cookiesession 基本就这个意思,自己再改改吧import java.io.*;import java.net.Socket;import java.util.Properties;/** * Created by IntelliJ IDEA. * Author: HUBIN * Date: 2005-3-15 * Time: 14:20:07 */public class Login { static String txt = "POST http://www.xxx.com/index.aspx HTTP/1.0\n" + "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*\n" + "Referer: http://www.xxx.com/index.aspx\n" + "Accept-Language: zh-cn\n" + "Content-Type: application/x-www-form-urlencoded\n" + "Proxy-Connection: Keep-Alive\n" + "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; MyIE2; Maxthon; .NET CLR 1.0.3705)\n" + "Host: kq\n" + "Content-Length: 31\n" + "Pragma: no-cache\n" + "Cookie: ASP.NET_SessionId=lek1euepbok3uoii4dcony45\n" + "\n" + "txtUserCd=AAAA&txtPassword=BBBB"; public static Properties ppt = new Properties(); private static final String filename = "setup.properties"; private static String server = "192.168.0.1"; private static int port = 80; static { try { ppt.load(new FileInputStream(filename)); server = ppt.getProperty("server"); port = Integer.parseInt(ppt.getProperty("port")); } catch (Exception e) { e.printStackTrace(); //Todo } } public static void main(String[] args) { OutputStream outsend = null; try { Socket outSkt = new Socket(server, port); outsend = new BufferedOutputStream(outSkt.getOutputStream()); System.out.println(txt); outsend.write(txt.getBytes()); outsend.flush(); } catch (IOException e) { e.printStackTrace(); //Todo } finally { try { outsend.close(); } catch (IOException e) { e.printStackTrace(); //Todo } } }} 弄个yahoo的验证码看你老板还彪。 楼主的意思可能是要cookie+session实现,在会话跟踪中,如果浏览器没开cookie,那就需要使用其他技术,好像是URL回写,具体的查一下HttpServletResponse接口中encodeRedirectURL(String) & encodeURL(String) ; java导入包问题 类型安全:从 Object 强制类型转换为 List<Student> 实际上是对已擦除的类 型 List 进行检查 javac:需要} 如何打开Dic或者Dct格式文件 遇到个这样的问题“java.lang.ClassCastException: java.lang.Integer” 关于运行.class文件的一个基础问题 to:FAX2U (FAX) 100分+挥泪裸跪Swing高手! java初学提问,送分 高手指点, 能否在java中使用IE等window控件? 关于java的P2P语音聊天软件的开发,希望大家帮助!!!!
既然你知道用户名和密码了,就直接用
<input type=hidden name="username" vlaue="小王">
<input type=hidden name="password" vlaue="密码">
传给下一页就可以了
不知道是不是你想表达的意思
cookie
session
import java.io.*;
import java.net.Socket;
import java.util.Properties;/**
* Created by IntelliJ IDEA.
* Author: HUBIN
* Date: 2005-3-15
* Time: 14:20:07
*/
public class Login {
static String txt = "POST http://www.xxx.com/index.aspx HTTP/1.0\n" +
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*\n" +
"Referer: http://www.xxx.com/index.aspx\n" +
"Accept-Language: zh-cn\n" +
"Content-Type: application/x-www-form-urlencoded\n" +
"Proxy-Connection: Keep-Alive\n" +
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; MyIE2; Maxthon; .NET CLR 1.0.3705)\n" +
"Host: kq\n" +
"Content-Length: 31\n" +
"Pragma: no-cache\n" +
"Cookie: ASP.NET_SessionId=lek1euepbok3uoii4dcony45\n" +
"\n" +
"txtUserCd=AAAA&txtPassword=BBBB"; public static Properties ppt = new Properties(); private static final String filename = "setup.properties"; private static String server = "192.168.0.1";
private static int port = 80; static {
try {
ppt.load(new FileInputStream(filename));
server = ppt.getProperty("server");
port = Integer.parseInt(ppt.getProperty("port"));
} catch (Exception e) {
e.printStackTrace(); //Todo
}
} public static void main(String[] args) {
OutputStream outsend = null; try {
Socket outSkt = new Socket(server, port);
outsend = new BufferedOutputStream(outSkt.getOutputStream());
System.out.println(txt);
outsend.write(txt.getBytes());
outsend.flush();
} catch (IOException e) {
e.printStackTrace(); //Todo
} finally {
try {
outsend.close();
} catch (IOException e) {
e.printStackTrace(); //Todo
}
}
}
}