vb웹페이지 내용 그대로 읽어오기 소스
Imports
System.Net
Imports
System.IO
Imports
System.Text.RegularExpressions
Public
Class
Form1
Private
Sub
Button1_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
Button1.Click
If
TextBox1.Text.Length < 10
Then
MsgBox(
"가져올 페이지의 URL을 입력하세요!"
)
Return
End
If
Try
Dim
wresp
As
WebResponse
Dim
wreq
As
WebRequest = HttpWebRequest.Create(TextBox1.Text)
Dim
str
As
String
=
""
wresp = wreq.GetResponse()
Using sr
As
New
StreamReader(wresp.GetResponseStream())
str = sr.ReadToEnd()
sr.Close()
End
Using
Dim
sta
As
Integer
sta = InStr(str,
"<body"
)
If
sta = 0
Then
sta = InStr(str,
"<BODY"
)
If
sta = 0
Then
sta = 1
str = Regex.Replace(Mid(str, sta),
"<.*?>"
,
""
)
TextBox2.Text = str
Catch
ex
As
Exception
MsgBox(ex.Message,
"가져오기 실패"
)
End
Try
End
Sub
End
Class
http://yaraba.tistory.com/412 페이지에서 참조