//************************************** // Name: Download a web page - VB.NET // Description:Function to download a URL. // By: Milton Sozezzo (from psc cd) // // // Inputs:None // // Returns:None // //Assumes:New version to "Download a web page to a string" (http://www.planet-source-code.com/vb/scripts/showcode.asp?lngWId=10&txtCodeId=86) // //Side Effects:None //************************************** Public Function GetPageHTTP(ByVal URL As String) As String 'Ex.: dim s As string = GetPageHTTP("htt // p://www.uol.com.br") 'Ex.: dim x As string = GetPageHTTP("htt // p://www.microsoft.com/") 'Ex.: dim x As string = GetPageHTTP("htt // p://www.planet-source-code.com/vb/defaul // t.asp?lngWId=10") Dim wc As New System.Net.WebClient() Dim s As System.IO.Stream = wc.OpenRead(URL) Dim r As String Dim sr As System.IO.StreamReader = New System.IO.StreamReader(s, System.Text.Encoding.UTF7, False) r = sr.ReadToEnd() Return r End Function