/**
文件名:Zol.Java
说明: 自动在中关村二手市场提交信息的程序
作者: 慈勤强
Email : cQQ1978@Gmail.com
**/
import java.io.*;
import java.net.*;
class Zol
{
public String strCookie="";
private String login() //get cookie
{
String strUrl="http://www.zol.com.cn/user/login.PHP";
String strPwd="sssssssss"; //注册的用户名
String strUser="dddddddd"; //密码
String strPostData="User="+strUser+"&PassWord="+strPwd;
String strTmp;
try
{
URL url = new URL(strUrl);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(strPostData);
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
wr.close();
rd.close();
StringBuffer sb=new StringBuffer("");
for (int i=0; ; i++)
{
String headerName = conn.getHeaderFieldKey(i);
String headerValue = conn.getHeaderField(i);
if(headerName!=null && headerName.equalsIgnoreCase("set-cookie"))
{
int j=headerValue.indexOf(";");
sb.append(headerValue.substring(0,j)+";");
}
if (headerName == null && headerValue == null)
{
break;
}
}
return sb.toString();
}
catch(Exception e)
{
return "err";
}
}
private String doPost()
{
String strUrl="http://flea.zol.com.cn/input_save.PHP";
String s1="game_board=0&"; //s1为提交的信息的具体说明,可以参考
s1=s1+"title=http://blog.csdn.net/cqq&";
s1=s1+"categoryNumber=5&";
s1=s1+"photo_file=&";
s1=s1+"subcategoryNumber=70&";
s1=s1+"areaNumber=2&";
s1=s1+"tradeModeNumber=1&";
s1=s1+"hownew=f&";
s1=s1+"price=111&";
s1=s1+"endTime=8&";
s1=s1+"brief=本信息由 http://blog.csdn.net/cqq 自动发出&";
s1=s1+"linkman=cqq&";
s1=s1+"phone=12345678&";
s1=s1+"email=sss@sss.net";