用DOM实现文章采集--采集到网页源码(8)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:40 点击:次
byte[] buffer = new byte[256];
int c = stream.Read(buffer, 0, buffer.Length);
while (c > 0)
{
ms.Write(buffer, 0, c);
c = stream.Read(buffer, 0, buffer.Length);
}
stream.Close();
info.StatusCode = response.StatusCode;
info.Bytes = ms.ToArray();
}
catch (WebException WE)
{
if (WE.Response != null)
{
info.StatusCode = (WE.Response as HttpWebResponse).StatusCode;
}
else
{
info.StatusCode = HttpStatusCode.ServiceUnavailable;
}
return null;
}
catch
{
info.StatusCode = HttpStatusCode.InternalServerError;
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>