获取验证码图片
http://bbs.xiaomi.cn/thread-5488240-1-1.html我想获取小米论坛的验证码图片,有什么办法
用C#解决 --------------------编程问答-------------------- 楼主仔细查阅下 httpWebRequest 与 httpWebResponse
这样,我的方法给你贴出来
--------------------编程问答-------------------- 还有什么办法么 --------------------编程问答-------------------- 办法很多,我给你的例子是最好最实用的。 --------------------编程问答-------------------- 直接使用WebClient类的DownLoadFile --------------------编程问答-------------------- 有详细点的吗?
public Stream GetStream()
{
HttpWebResponse httpWebResponse = null;
HttpWebRequest httpWebRequest;
httpWebRequest.Method = Method;
httpWebRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
httpWebRequest.Headers["Accept-Charset"] = "GBK,utf-8;q=0.7,*;q=0.3";
httpWebRequest.Headers["Accept-Language"] = "zh-CN,zh;q=0.8";
httpWebRequest.Headers["Cache-Control"] = "max-age=0";
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.CookieContainer = cookie;
httpWebRequest.Referer = Url;
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5";
httpWebRequest.Proxy = null;
httpWebRequest.AllowAutoRedirect = true;
httpWebRequest.Timeout = 10000;
httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
return httpWebResponse.GetResponseStream();
}
this.pictureBox1.Image = GetStream();
补充:.NET技术 , 其他语言