2013-12-23 57 views

回答

0

你可以簡單的寫了下面的代碼:

HttpWebRequest httpReq = (HttpWebRequest)HttpWebRequest.Create(new Uri("https://www.yourURL.com")); 
httpReq.BeginGetResponse(HTTPWebRequestCallBack, httpReq); 
private void HTTPWebRequestCallBack(IAsyncResult result) 
     { 
     string strResponse = ""; 
     try 
     { 
     Deployment.Current.Dispatcher.BeginInvoke(() => 
     { 
     try 
     { 
     HttpWebRequest httpRequest = (HttpWebRequest)result.AsyncState; 
     WebResponse response = httpRequest.EndGetResponse(result); 

     Stream stream = response.GetResponseStream(); 
     StreamReader reader = new StreamReader(stream); 
     strResponse = reader.ReadToEnd(); 
     //do you logic of TTS here 
     } 
     catch (Exception ex) 
     {} 
     }); 
     } 
     catch (Exception e) 
     {} 
     } 

這將讓該頁面中的所有文本,當然也包括HTML標籤 如果你想更專業的方式來獲得特定的標籤在你的網頁 檢查以下帖子 http://developer.nokia.com/Community/Wiki/HTML_Page_parsing_using_HTMLAgilityPack