我想通过自动登录zhaopin.com的HR端,并自动进行简历的挑选。
很早以前写好了能用,但是有几年没用了,现在好像改版了,需要登录验证码了,而且,登录方式好像也变化了。
以下是我写的代码,通过手工输入验证码的方式实现。但是死活登录不上,已经研究了一两周了,实在搞不清楚了,请大家帮忙看看,哪里出问题了。尤其没搞清楚那个dywe.js的作用。谢谢了!
[C#] 纯文本查看 复制代码
string url = String.Format("http://www.zhaopin.com/");
HttpItem item = new HttpItem()
{
UserAgent ="Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko",
Accept ="text/html, application/xhtml+xml, */*",
URL = url
};
http = new HttpHelper();
//httpresult = http.GetHtml(item);
//TraceLog.PrintLn(httpresult.Html );
//Cookies = httpresult.Cookie;
url = String.Format("http://hr.zhaopin.com/hrclub/index.html");
item = new HttpItem()
{
UserAgent = "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko",
Accept = "text/html, application/xhtml+xml, */*",
URL = url
};
httpresult = http.GetHtml(item);
//TraceLog.PrintLn(httpresult.Html);
Cookies = httpresult.Cookie;
url = "http://rd2.zhaopin.com/s/loginmgr/picturetimestamp.asp?t="+currentTimeMillis();
item = new HttpItem()
{
URL = url,
ResultType = ResultType.Byte
};
httpresult = http.GetHtml(item);
Cookies = httpresult.Cookie;
Util aUtil = new Util();
Image img = aUtil.byteArrayToImage(httpresult.ResultByte);
img.Save("c:/a.gif" );
String pictext1 = Console.ReadLine();
//httpresult = http.GetHtml(item);
//TraceLog.PrintLn(httpresult.Html);
url = "http://rd2.zhaopin.com/loginmgr/loginproc.asp?DYWE=1402838541843.380746.1402838542.1403269921.2";
//url = "http://rd2.zhaopin.com/loginmgr/loginproc.asp";
string postdata2 = String.Format("username={0}&password={1}&Validate={2}&Submit=", username, password, pictext);
//Cookies = "dywec=95841923; __utmc=269921210; __zpWAMs2=1; JsNewlogin=131012127; RDpUserInfo=; RDsUserInfo=; cgmark=2; isNewUser=1; dywea=95841923.15031524388057552.1402838524.1402838524.1402838524.1; dyweb=95841923.15.10.1402838524; dywez=95841923.1402838524.1.1.dywecsr=(direct)|dyweccn=(direct)|dywecmd=(none)|dywectr=undefined; __utma=269921210.228421887.1402838524.1402838524.1402838524.1; __utmb=269921210.15.10.1402838524; __utmz=269921210.1402838524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmv=269921210.|2=Member=131012127=1; __zpWAM=1402838541843.380746.1402838542.1402838542.1; __zpWAMs1=1; " + Cookies;
item = new HttpItem()
{
URL =url,
Method = "POST",
Accept = "text/html, application/xhtml+xml, */*",
ContentType = "application/x-www-form-urlencoded",
Referer = "http://hr.zhaopin.com/hrclub/index.html",
Cookie =Cookies,
Postdata = postdata2,
Allowautoredirect=true
};
httpresult = http.GetHtml(item);
Cookies = httpresult.Cookie;
|