將目標網址轉換成HTML
using System.IO;
using System.Net;
private static string UrlToHtml(string url,System.Text.Encoding encode)
{
string strHtml = "<BASE HREF=\"" + url + "\"/>";
try
{
StreamReader sr;
WebRequest HttpWebRequest = WebRequest.Create(url);
WebResponse HttpWebResponse = HttpWebRequest.GetResponse();
sr = new StreamReader(HttpWebResponse.GetResponseStream(),encode);
strHtml += sr.ReadToEnd();
sr.Close();
}
catch
{}
finally
{}
return strHtml;
}