Developer Forum [ All Topics | New Topic ]

Thread: Download ROUND & FANCY CSV File

Use This Code : 

            SetControlPropertyValue(lblObjectName, "Text", "Connecting to server . . .")
            SetProgress(1)
            Dim requestUriString As String = "https://technet.rapaport.com/HTTP/Authenticate.aspx"
            Dim request As WebRequest = WebRequest.Create(requestUriString)
            Me.Refresh()
            request.Method = "POST"
            request.ContentType = "application/x-www-form-urlencoded"
            Dim requestStream As Stream = request.GetRequestStream()
            SetProgress(2)
            SetControlPropertyValue(lblObjectName, "Text", "Authenticating . . .")
            Me.Refresh()
            Dim s As String = ("username=" & UserId & "&password=" & Password)
            Dim bytes As Byte() = Encoding.ASCII.GetBytes(s)
            requestStream.Write(bytes, 0, bytes.Length)
            requestStream.Close()
            SetProgress(3)
            SetControlPropertyValue(lblObjectName, "Text", "Downloading Rapaport . . .")
            Me.Refresh()
            Dim reader As New StreamReader(request.GetResponse.GetResponseStream())
            Dim str4 As String = reader.ReadToEnd
            ''---- for Round
            'Dim str1 As String
            'str1 = "http://technet.rapaport.com/HTTP/Prices/CSV2_Round.aspx?ticket=" & str4
            SetProgress(4)
            SetControlPropertyValue(lblObjectName, "Text", "Downloading Rapaport for Round . . .")
            Me.Refresh()
            request =             WebRequest.Create(("http://technet.rapaport.com/HTTP/Prices/CSV2_Round.aspx?ticket="             & str4))
            request.Method = "GET"
            Dim reader2 As New StreamReader(request.GetResponse.GetResponseStream)
            ''-------- for Pear
            SetProgress(5)
            SetControlPropertyValue(lblObjectName, "Text", "Downloading Rapaport for Pear . . .")
            Me.Refresh()
            request = WebRequest.Create(("http://technet.rapaport.com/HTTP/Prices/CSV2_Pear.aspx?ticket=" & str4))
            request.Method = "GET"
            Dim reader3 As New StreamReader(request.GetResponse.GetResponseStream)
            Dim str1 As String
            SetProgress(6)
            SetControlPropertyValue(lblObjectName, "Text", "Insert Rapaport for Round . . .")
            Me.Refresh()
            'Using tw As TextWriter = New StreamWriter("c:\resultRound.csv", True)
            str1 = reader2.ReadLine
            Dim arr() As String = str1.Split(",")


>> add a comment
Hiren
01/08/2014 06:54


0 Replies: