수다님 한가지더 질문 할께요ㅎ
한가람
Public Cookie As New Net.CookieContainerDim korstart As String
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load - 로그인부분wReq = Net.WebRequest.Create(urlA)wReq.Method = POSTwReq.CookieContainer = Cookie
Dim sWriter As IO.StreamWriter = New IO.StreamWriter(wReq.GetRequestStream) sWriter.Write(uid=아이디&password=비번)sWriter.Close()
Dim sReader As IO.StreamReader = New IO.StreamReader(wReq.GetResponse.GetResponseStream, System.Text.Encoding.UTF8)end sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click - 리스트뷰로 자료 리스트 가져오기 korstart = urlB Dim REQUEST As HttpWebRequest = HttpWebRequest.Create(korstart) REQUEST.Method = GET REQUEST.CookieContainer = Cookie
Dim RESPONES As HttpWebResponse = REQUEST.GetResponse Dim RSTREAM As System.IO.Stream = RESPONES.GetResponseStream
Dim STREAMREADER As New System.IO.StreamReader(RSTREAM) Dim DATA As String = STREAMREADER.ReadToEnd STREAMREADER.Close()end sub
Private Sub caldata() - 해당자료의 주소 가져오기 Dim REQUEST As HttpWebRequest = HttpWebRequest.Create(urlC) REQUEST.Method = GET REQUEST.CookieContainer = Cookie
Dim RESPONES As HttpWebResponse = REQUEST.GetResponse Dim RSTREAM As System.IO.Stream = RESPONES.GetResponseStream
Dim STREAMREADER As New System.IO.StreamReader(RSTREAM) Dim DATA As String = STREAMREADER.ReadToEnd STREAMREADER.Close()
filedw = Split(Split(DATA, a href=)(1), title=)(0)end sub
여기까지 도움 주신대로 따라했는데 다운로드부분에서 막혀서 다시 질문드립니다.로그인을 안해도 되면 WebBrowser1.Navigate(주소)나 shell문을 이용했는데 두개다 안되네요ㅠ힌트부탁드립니다ㅠㅠ--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------위의 소스 밑에다가 이렇게 붙이면 되는건가요?Private Sub downloadFile(url As String, fileName As String)/sping) Dim request As HttpWebRequest = HttpWebRequest.Create(urlC) request.CookieContainer = Cookie Dim response As HttpWebResponse = request.GetResponse Dim stream As Stream = response.GetResponseStream Dim fs As New FileStream(fileName, FileMode.Create) -fileName은 제가 작성하는 건가요? Dim readBytes As Byte() = New Byte(1024) {} Dim cnt As Integer = stream.Read(readBytes, 0, readBytes.Length) While cnt 0 fs.Write(readBytes, 0, cnt) cnt = stream.Read(readBytes, 0, readBytes.Length) End While fs.Close() stream.Close()End Sub