Public cHTML As String = "" Public cMessage As String = "" Public cPassword As String = "" Public cUrl As String = "" Public cUsername As String = "" Public nTimeout As Integer = 0 ' Get the HTML response from a server Public Function GetUrl() As Boolean Dim lcUrl As System.Uri = Nothing Dim llSuccess As Boolean = False Dim loHTTP As System.Net.HttpWebRequest = Nothing Dim loStream As System.IO.Stream = Nothing Dim loString As System.IO.StreamReader = Nothing Dim loWebResponse As System.Net.WebResponse = Nothing ' Reset the values cHTML = "" ' If we have a URL If cUrl.Length > 0 Then ' Make it into a Uri lcUrl = New System.Uri(cUrl) ' Make it into a Web request loHTTP = System.Net.HttpWebRequest.Create(lcUrl) ' If we have a timeout If nTimeout > 0 Then loHTTP.Timeout = nTimeout End If ' If we have a username If cUsername.Length > 0 Then ' Establish the basic authentication loHTTP.Credentials = New System.Net.NetworkCredential(cUsername, cPassword) End If Try loWebResponse = loHTTP.GetResponse() loStream = loWebResponse.GetResponseStream() loString = New System.IO.StreamReader(loStream) cHTML = loString.ReadToEnd() llSuccess = True Catch loError As Exception cMessage = loError.Message End Try Else cMessage = cURLCannotBeEmpty End If ' Reset the values cPassword = "" cUrl = "" cUsername = "" nTimeout = 0 Return llSuccess End Function