public string getSource(string url,string encoding) { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse webresponse = (HttpWebResponse)request.GetResponse(); StreamReader streamReader = new StreamReader(webresponse.GetResponseStream(), Encoding.GetEncoding(encoding)); //可改不同編碼 return streamReader.ReadToEnd(); } catch { return null; } }
留言
張貼留言