获取验证码代码: 
GetTime() 是时间戳 
 
 
[C#] 纯文本查看 复制代码 http = new HttpHelper();
            item = new HttpItem()
            {
                URL = "http://www.ganji.com/common/checkcode.php?nocache=" + GetTime(),//URL     必需项    
                Method = "get",//URL     可选项 默认为Get   
                IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                Timeout = 100000,//连接超时时间     可选项默认为100000    
                ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统     可选项有默认值   
                ContentType = "text/html",//返回类型    可选项有默认值   
                Allowautoredirect = false,//是否根据301跳转     可选项   
                ResultType = ResultType.Byte
            };
            result = http.GetHtml(item);
            cookies = result.Cookie;
            pictureBox1.Image = byteArrayToImage(result.ResultByte); 
 
 
 
注册代码: 
[C#] 纯文本查看 复制代码             HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = "http://www.ganji.com/user/register.php",//URL     必需项    
                Method = "get",//URL     可选项 默认为Get   
                IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                Cookie = "ganji_reqid=67de8b13-965d-4752-d948-8359a189f2d9; _gl_tracker=%7B%22sid%22%3A56520966361%7D; __utma=32156897.1397785323.1395319937.1395325489.1395648141.4; __utmz=32156897.1395319937.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); ganji_uuid=7864747741650978280578; citydomain=hz; ganji_xuuid=d33e3d05-1a22-49a0-aaae-94da0c2bfd1c; codecheck=1; GANJISESSID=45c3a95a4fd086c5ddd439782b8e4e96; __utmb=32156897.2.10.1395648141; __utmc=32156897",//字符串Cookie     可选项   
                Referer ="http://www.ganji.com/user/register.php?next=/",//来源URL     可选项   
                Postdata = "source=passport&username=dsadasddf&password=5201314666&checkCode=undefined&expireDays=0&next=%2F&password2=5201314666&affirm=14&checkcode=gtyd",//Post数据     可选项GET时不需要写   
                Timeout = 100000,//连接超时时间     可选项默认为100000    
                ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统     可选项有默认值   
                ContentType = "application/x-www-form-urlencoded",//返回类型    可选项有默认值   
                Allowautoredirect = false,//是否根据301跳转     可选项   
                //CerPath = "d:\123.cer",//证书绝对路径     可选项不需要证书时可以不写这个参数   
                //Connectionlimit = 1024,//最大连接数     可选项 默认为1024    
                ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数    
                //ProxyPwd = "123456",//代理服务器密码     可选项    
                //ProxyUserName = "administrator",//代理服务器账户名     可选项   
                ResultType = ResultType.String
            };
            HttpResult result = http.GetHtml(item);
            string html = result.Html;
            string cookie = result.Cookie;
        
 
 |