代码
/// <summary>
/// 获取页面源代码
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static string GetPageResouceCode(string url)
{
try
{
WebRequest wrt = WebRequest.Create(url);
WebResponse wrse = wrt.GetResponse();
Stream strM = wrse.GetResponseStream();
StreamReader SR = new StreamReader(strM, Encoding.UTF8);
string strallstrm = SR.ReadToEnd();
return strallstrm;
}
catch {
return "";
}
}
/// 获取页面源代码
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static string GetPageResouceCode(string url)
{
try
{
WebRequest wrt = WebRequest.Create(url);
WebResponse wrse = wrt.GetResponse();
Stream strM = wrse.GetResponseStream();
StreamReader SR = new StreamReader(strM, Encoding.UTF8);
string strallstrm = SR.ReadToEnd();
return strallstrm;
}
catch {
return "";
}
}
,这个送给你!