0

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)

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by codeorder
0

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.

0

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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.