Is this possible?
Download a webpage source without using a browser and place in to a textbox ready to edit and post(stop page/image load times)
Is this possible?
Download a webpage source without using a browser and place in to a textbox ready to edit and post(stop page/image load times)
Any help guys?
You will want to look at the httpwebrequest class and its methods. You can feed it a URL and get back the source (page) to do with as you will. The MSDN articles that come up of you google httpwebrequest will help you.
Since already in my code.snippets, see if this helps.:)
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
TextBox1.Text = getCoolHttp("http://www.daniweb.com/members/codeorder/811140")
End Sub
Private Function getCoolHttp(ByVal selCoolUrl As String) As String
Me.Cursor = Cursors.WaitCursor
Try
Dim myResponse As Net.HttpWebResponse = Net.HttpWebRequest.Create(selCoolUrl).GetResponse '// connect.
Dim myStream As IO.Stream = myResponse.GetResponseStream() '// get.
Dim myReader As New IO.StreamReader(myStream) '// read.
Dim webContent As String = myReader.ReadToEnd
myReader.Close() : myStream.Close() : myResponse.Close()
Me.Cursor = Cursors.Default
Return webContent
Catch ex As Exception
Me.Cursor = Cursors.Default
MsgBox("Connection Error.", MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.