大家看看在下面的html页面中显示的是一张图片,怎么用程序的方法进行下载?
<html><body><img class="Tel" src="http://count.koubei.com/showphone/showphone.php?f=jpg&w=200&h=30&bc=255,255,255&fc=0,0,0&fs=20&fn=arial&phone=LTExNDEzMjI1NQ%3D%3D%23wBIlVAFItsh9Wqge"/></body></html>这个图片比较特殊,如果是很明显的如http://pmp.aura.cn/xyh/images/xyh-090602_06.jpg我会下载,使用如下的方法:
public Bitmap GetImage(WebClient client){
Byte[] b = client.DownloadData(url);
Stream sm = new MemoryStream(b);
return new Bitmap(sm);
}
public void Save(WebClient client,string path)
{
Bitmap bm = GetImage(client);
bm.Save(path);
}
但是对于上面那种情况会失败,得到Byte[] b的大小为0有请大侠解答一下
<html><body><img class="Tel" src="http://count.koubei.com/showphone/showphone.php?f=jpg&w=200&h=30&bc=255,255,255&fc=0,0,0&fs=20&fn=arial&phone=LTExNDEzMjI1NQ%3D%3D%23wBIlVAFItsh9Wqge"/></body></html>这个图片比较特殊,如果是很明显的如http://pmp.aura.cn/xyh/images/xyh-090602_06.jpg我会下载,使用如下的方法:
public Bitmap GetImage(WebClient client){
Byte[] b = client.DownloadData(url);
Stream sm = new MemoryStream(b);
return new Bitmap(sm);
}
public void Save(WebClient client,string path)
{
Bitmap bm = GetImage(client);
bm.Save(path);
}
但是对于上面那种情况会失败,得到Byte[] b的大小为0有请大侠解答一下
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货