|
-
Jun 12th, 2011, 03:30 PM
#6
Thread Starter
Member
Re: Getting a website source code.
 Originally Posted by kevininstructor
This returned the source of your page just fine
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim test = GetHtmlPageSource("http://jamesbwoii.fileave.com/hello.html")
Console.WriteLine("[{0}]", test)
End Sub
Function GetHtmlPageSource(ByVal url As String) As String
Dim Result As String = ""
Try
Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(url)
Dim resp As System.Net.WebResponse = req.GetResponse
Using reader As IO.StreamReader = New IO.StreamReader(resp.GetResponseStream)
Result = reader.ReadToEnd
End Using
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Return Result
End Function
I tried that and it didn't work. I clicked the button and nothing happened. What's going wrong?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|