Skip to content

How to get html source from url ?

tran tuan

Asked Jul 16, 2007, 7:13 PM EDT2 answers
Share
LinkedInX
I want write a program to get html source from webpage. Please help me ! Thank you

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    use this code pass url Private Sub getSource(ByVal url As String) On Error Resume Next usysbusy = True lblMsg.Text = "Sending Request......" Application.DoEvents() Dim myRequest As WebRequest = WebRequest.Create(url) lblMsg.Text = "Receving Response......" Application.DoEvents() Dim myResponse As WebResponse = myRequest.GetResponse() lblMsg.Text = "Reading Response......" Application.DoEvents() Dim str As Stream = myResponse.GetResponseStream() Dim mystr As StreamReader = New StreamReader(str) Dim respHTML As String = mystr.ReadToEnd() searchData = TrimAll(respHTML) searchData = TrimAll(Trim(respHTML.Trim(delim.ToCharArray()))) 'searchData = respHTML txtSource.Text = searchData lblMsg.Text = "Saving : " & url Application.DoEvents() Application.DoEvents() myResponse.Close() usysbusy = False End Sub
    0
  • 1 short reply
    • 0
      it works fine...
      0