日期:2014-05-17 浏览次数:21114 次
/// 获取验证码方法
/// </summary>
public static Bitmap LoadImg(string ImageUrl)
{
try
{
HttpWebRequest wrq = (HttpWebRequest)WebRequest.Create(ImageUrl);//请求的URL
wrq.Method = "GET";
wrq.Timeout = 5000;
wrq.ContentType = "application/x-www-form-urlencoded";
//获取返回资源
HttpWebResponse response = (HttpWebResponse)wrq.GetResponse();
//获取流
Bitmap bt = Bitmap.FromStream(response.GetResponseStream()) as Bitmap;
return bt;
}
catch
{
return null;
}
}
pictureBox1.Load("http://captcha.qq.com/getimage?uin=88552244&aid=549000912&0.5529732842087849");