代码很土,我是用最土的方法,Socket来连接的,
然后把cookies什么发过去
发给我个研究研究,不要那么小气吗我邮箱tianguisu@163.com
老牛明知夕阳晚,不用扬鞭自奋蹄; .cn/AngeloWang" target="_blank">Angelo\'s BLOG
代码很土,我是用最土的方法,Socket来连接的,
然后把cookies什么发过去
发给我个研究研究,不要那么小气吗我邮箱tianguisu@163.com
[CODE]/*
* Test.java
*
* Created on 2006年12月22日, 下午3:25
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package net.bccn.bbs.dproxy.server;
/**
*
* @author lbf
*/
import java.io.*;
import java.net.*;
public class Test {
private String output;
/** Creates a new instance of Test */
public Test() {
output=getContent();
for(int w=0;w<10;w++){
new Thread(new Runnable(){
public void run(){
int i=0;
while(i<100){
i++;
send();
}
}
}).start();
}
}
private String getContent(){
try{
StringBuffer sb=new StringBuffer("POST http://bbs.bc-cn.net/savepost.asp?action=sre&method=fastreply&BoardID=35 HTTP/1.0\n");
String temp="";
BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream("content.txt")));
while((temp=br.readLine())!=null){
sb.append(temp+"\n");
}
return sb.toString();
} catch(Exception exe){
exe.printStackTrace();
return "";
}
}
private void send(){
try{
Socket s=new Socket("bbs.bc-cn.net",80);
PrintWriter pw=new PrintWriter(new OutputStreamWriter(s.getOutputStream()));
pw.println(output);
pw.flush();
System.out.println("发送完毕!");
// BufferedReader br=new BufferedReader(new InputStreamReader(s.getInputStream()));
// String input="";
// while((input=br.readLine())!=null){
// System.out.println("input="+input);
// }
} catch(Exception exe){
exe.printStackTrace();
}
}
public static void main(String[] args)throws Exception {
new Test();
}
}[/CODE]
先用我自己的代理程序查看到我发帖的一瞬间,发送到服务器的东西
然后把它保存下来,
用socket来发,起个多线程,更快
简单吧
[CODE]pw.println("POST http://bbs.bc-cn.net/savepost.asp?action=sre&method=fastreply&BoardID=35 HTTP/1.0");
pw.println("Accept: */*");
pw.println("Referer: http://bbs.bc-cn.net/viewthread.php?tid=111320");
pw.println("Accept-Language: zh-cn");
pw.println("Content-Type: application/x-www-form-urlencoded");
pw.println("Proxy-Connection: Keep-Alive");
pw.println("User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)");
pw.println("Host: bbs.bc-cn.net");
pw.println("Content-Length: 160");
pw.println("Pragma: no-cache");
pw.println("Cookie: AJSTAT_ok_times=102; DvForum=UserID=49814&usercookies=1&password=DhXKBnM0971WF067&userhidden=2&userclass=%B0%E6%D6%F7&username=%C7%A7%C0%EF%B1%F9%B7%E2&StatUserID=12577466907; AJSTAT_ok_pages=1172; ASPSESSIONIDQCAQASAS=EEIFFGMBFKEGPPFCGPHJFNEE; Dvbbs=; upNum=0\n");
pw.println("Body=%D5%E2%CA%C7%B2%E2%CA%D4%CC%FB.%B2%E2%CA%D4%CB%D9%B6%C8%B6%F8%D2%D1%2C%B2%BB%D2%AABS%CE%D2%5Bem04%5D%5Bem04%5D%3CBR%3E&followup=433726&RootID=111320&star=1&TotalUseTable=Dv_bbs2&UserName=%C7%A7%C0%EF%B1%F9%B7%E2&signflag=1");
pw.println("host=http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-5627082186747628&dt=1166774087758&lmt=1166774087&format=728x90_as&output=html&channel=0574652011&url=http%3A%2F%2Fbbs.bc-cn.net%2Fsavepost.asp%3Faction%3Dsre%26method%3Dfastreply%26BoardID%3D35&color_bg=FFFFFF&color_text=555555&color_link=0000EE&color_url=555555&color_border=FFFFFF&ad_type=text_image&ref=http%3A%2F%2Fbbs.bc-cn.net%2Fdispbbs.asp%3FboardID%3D35%26ID%3D111320%26page%3D1&cc=178&u_h=768&u_w=1024&u_ah=738&u_aw=1024&u_cd=32&u_tz=480&u_his=12&u_java=true");
pw.println("host=http://37.db.51.la/s.asp?id=10389&tpages=1173&ttimes=102&tzone=8&tcolor=32&sSize=1024,768&referrer=http%3A//bbs.bc-cn.net/dispbbs.asp%3FboardID%3D35%26ID%3D111320%26page%3D1&vpage=http%3A//bbs.bc-cn.net/savepost.asp%3Faction%3Dsre%26method%3Dfastreply%26BoardID%3D35\n\n");
pw.flush();[/CODE]