Html소스 받아오기

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

이 게시물을

공유하기

SEARCH

MENU NAVIGATION