本帖最后由 夏先森 于 2015-5-11 09:48 编辑
这个是获取验证码代码
[C#] 纯文本查看 复制代码 HttpItem item = new HttpItem()
{
URL = "http://ypt.car188.net/ValidCode.aspx?NumKey=0.14084825315512717",
Method = "get",//URL 可选项 默认为Get
ResultType = ResultType.Byte
};
//得到HTML代码
result = http.GetHtml(item);
cookie = result.Cookie;
Image img = byteArrayToImage(result.ResultByte);
pic_Box.Image = img;
[C#] 纯文本查看 复制代码 String postData = "txtname=" + tb_usrName.Text + "&txtpwd=" + tb_pwd.Text + "&txtvaild=" + tb_check.Text + "&btnlogin=%B5%C7%C2%BC";
item = new HttpItem()
{
URL = "http://ypt.car188.net/login.aspx",//URL这里都是测试URl 必需项
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
Method = "post",//URL 可选项 默认为Get
Postdata = postData,
ContentType = "text/html; charset=gb2312",
Cookie = cookie + ";user=aijunxing1234",
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
Referer = "http://ypt.car188.net/",
ResultCookieType = ResultCookieType.CookieCollection
};
/////item.Header.Add("x-requested-with", "XMLHttpRequest");
result = http.GetHtml(item);
item = new HttpItem()
{
URL = "[img]file:///C:\Users\fds\AppData\Local\Temp\%W@GJ$ACOF(TYDYECOKVDYB.png[/img]http://ypt.car188.net/ashx/GetMaker.ashx?datas=0.7432584260435373&selectType=C",//URL这里都是测试URl 必需项
ContentType = "text/plain; charset=gb2312",
Method = "get",//URL 可选项 默认为Get,
Cookie = cookie + ";user=aijunxing1234"
};
result = http.GetHtml(item);
|