Hi All,
I know this is probably going to be very simple but looking for some help.
Currently i have a program that can put a website such as "www.google.co.uk" and pull all the HTML and put all that HTML inside a textbox unformatted.
Is there a way i can use an array maybe? or a storage container of some sort to KEEP that HTML inside that array or storage solution instead of just in a textbox?
Code is below!
Public Function GetPageHTML(ByVal URL As String, _
Optional ByVal TimeoutSeconds As Integer = 60) _
As String
Dim objRequest As Net.WebRequest
Dim objResponse As Net.WebResponse
Dim objStreamReceive As System.IO.Stream
Dim objEncoding As System.Text.Encoding
Dim objStreamRead As System.IO.StreamReader
Try
objRequest = Net.WebRequest.Create(URL)
objRequest.Timeout = TimeoutSeconds * 1000
objResponse = objRequest.GetResponse
objStreamReceive = objResponse.GetResponseStream
objEncoding = System.Text.Encoding.GetEncoding( _
"utf-8")
objStreamRead = New System.IO.StreamReader( _
objStreamReceive, objEncoding)
GetPageHTML = objStreamRead.ReadToEnd()
If Not objResponse Is Nothing Then
objResponse.Close()
End If
Catch
Return ""
End Try
End Function
Private Sub gobutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gobutton.Click
imagestxt.Text = ""
WebBrowser1.Navigate(webaddresstxt.Text)
Dim strHTML As String
strHTML = GetPageHTML(webaddresstxt.Text, 5)
sourcecodetxt.Text = strHTML
End Sub