Html소스 받아오기

V닉맨 2014.05.21 11:20:50 *:

1. 새모듈을 추가하고 다음 코드를 입력한다

Imports System.Net

Public Module Module1

Public Function httpdown(Optional ByVal 주소 As String = "http://blog.daum.net/pootbar/")

        Dim wReq As WebRequest = WebRequest.Create(주소)

        Dim wResp As WebResponse = wReq.GetResponse

        Dim RespStream As System.IO.Stream = wResp.GetResponseStream

        Dim Reader As System.IO.StreamReader = New System.IO.StreamReader(RespStream, System.Text.Encoding.UTF8)

        Dim RespHTML As String = Reader.ReadToEnd

        Return RespHTML

    End Function

End Module

 

2.폼에서 다음과 같이 사용한다

 

Public Class Form1

 

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click


Module1.httpdown(http://blog.daum.net/pootbar/)

 

End Sub
End Class