public static string login(out string outcookie,out string out2cookie) { string cookie, code, username, userpass; username = "****";//用户名 userpass = "****";//密码 string posturl = "https://cas.baidu.com/?action=login"; getNumber("http://cas.baidu.com/?action=image&key=" + gettime() + "", "baidu_cas", out cookie, out code);//获取验证码和网页cookie cookie = cookie.Replace("domain=cas.baidu.com;", "");//整理cookie(对于跨域是必需的) string poststring = "appid=3&button2=" + System.Web.HttpUtility.UrlEncode("登 录") + "&charset=utf-8&entered_imagecode=" + code + "&entered_login=" + username + "&entered_password=" + userpass + "&fromu=" + System.Web.HttpUtility.UrlEncode("http://www2.baidu.com/") + "";//组织post内容 string refurl = "http://cas.baidu.com/?tpl=www2&fromu=http%3A%2F%2Fwww2.baidu.com%2F"; outcookie = null; out2cookie = null; string returnstring = PostPage(posturl, poststring, cookie, refurl, out outcookie);//提交 string geturl = ""; string ret2 = ""; string ret3 = ""; if (outcookie != null) { outcookie = outcookie.Replace("domain=cas.baidu.com;", "");//再次整理cookie geturl = geturlfromstr(returnstring);//获取转向的网址(http://www2.baidu.com/?castk=878d9sf7f8ea78bd5d515) ////继续访问 ret2 = GetHtml(geturl,false , outcookie,out out2cookie );//获得第二个cookie out2cookie = out2cookie.Replace("www2", "");//还是要对cookie做整理 } return ret2; }
以上就是本篇文章
【自动登录百度推广后台】的全部内容了,欢迎阅览 ! 文章地址:http://xiaoguoguo.dbeile.cn/quote/3155.html
行业
资讯
企业新闻
行情
企业黄页
同类资讯
网站地图
返回首页 多贝乐移动站 http://xiaoguoguo.dbeile.cn/mobile/ , 查看更多