none
How to convert code in this way For the proxy code 2 RRS feed

  • Question

  • I want to convert the code to work proxies

    from

      Private Sub Checker(login As String, pass As String)
            Dim dz As New Random()
            dz.[Next](0, 450)
            Dim dzd As New Random()
            dzd.[Next](0, 20)
            Dim diz As New Random()
            diz.[Next](0, 150)
            Try
                Listing.left -= 1
                Using httpRequest As HttpRequest = New HttpRequest()
                    httpRequest.Cookies = New CookieDictionary(False)
                    If Me.ComboBox1.Text = "HTTP/s" Then
                        httpRequest.Proxy = HttpProxyClient.Parse(Help.GetProxy())
                    End If
                    If Me.ComboBox1.Text = "SOCKS-4" Then
                        httpRequest.Proxy = Socks4ProxyClient.Parse(Help.GetProxy())
                    End If
                    If Me.ComboBox1.Text = "SOCKS-5" Then
                        httpRequest.Proxy = Socks5ProxyClient.Parse(Help.GetProxy())
                    End If
                    httpRequest.ConnectTimeout = CInt(Me.NumericUpDown2.Value) * 1000
                    httpRequest.UserAgent = Http.ChromeUserAgent()
                    httpRequest.AllowAutoRedirect = False
                    Dim array As String() = login.Split(New Char() {"@"c})
                    Dim str As String = String.Concat(New String() {"email=" + login + "&countryId=168&mode=5&eId=email&ru=http%3A%2F%2Fwww.ebay.com"})
                    httpRequest.AllowAutoRedirect = True
                    httpRequest.IgnoreProtocolErrors = False
                    httpRequest.Referer = "https://account.sonyentertainmentnetwork.com"
                    If httpRequest.Post("http://reg.ebay.com/reg/ajax", str, "application/x-www-form-urlencoded").ToString().Contains("{""content"":{""email"":""") Then
                        Directory.CreateDirectory("Result")
                        Dim doz As New Random(DateTime.Now.Millisecond)
                        Me.TextBox1.AppendText(login + ":" + pass + vbCrLf)
                        Me.DataResult("good", login + ":" + pass, "good")
                        File.AppendAllText("Result/Result[" + Help.time + "].txt", login + ":" + pass + vbCrLf)
                    Else
                        Me.DataResult("bad", array(0) + ":" + pass, "bad")
                    End If
                End Using
            Catch ex_20E As HttpException
                If Me.cbError.Checked Then
                    Me.DataResult("error", login + ":" + pass, "error")
                    Listing.left += 1
                Else
                    Me.DataResult("errorr", login + ":" + pass, "error")
                End If
            End Try
        End Sub

    to

    On this code

    Dim postData As String = ""
                    Dim tempCookies As New CookieContainer
                    Dim encoding As New UTF8Encoding
                    Dim byteData As Byte() = encoding.GetBytes(postData)
                    Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("url"), HttpWebRequest)
                    postReq.Method = "POST"
                    postReq.KeepAlive = True
                    postReq.CookieContainer = tempCookies
                    postReq.ContentType = "application/x-www-form-urlencoded"
                    postReq.Referer = "url"
                    postReq.UserAgent = "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14"
                    postReq.ContentLength = byteData.Length
                    Dim postreqstream As Stream = postReq.GetRequestStream()
                    postreqstream.Write(byteData, 0, byteData.Length)
                    postreqstream.Close()
                    Dim postresponse As HttpWebResponse
                    postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
                    tempCookies.Add(postresponse.Cookies)
                    logincookie = tempCookies
                    Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
                    Dim thepage As String = postreqreader.ReadToEnd

    Thank you


    • Edited by A-R-2017 Saturday, December 2, 2017 12:30 AM
    Saturday, December 2, 2017 12:28 AM

All replies

  • Hi A-R-2017,

    According to your second code,  I guess that you may want to get webpage text using httpwebrequest, but I don't know what you want to do about the first code. Can you describe the more detailed info here.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 4, 2017 8:59 AM
    Moderator
  • Hi A-R-2017,

    According to your second code,  I guess that you may want to get webpage text using httpwebrequest, but I don't know what you want to do about the first code. Can you describe the more detailed info here.

    Best Regards,

    Cherry



    I want to add this code here without error

    In this format

     Using httpRequest As HttpRequest = New HttpRequest()
                    httpRequest.Cookies = New CookieDictionary(False)
                    If Me.ComboBox1.Text = "HTTP/s" Then
                        httpRequest.Proxy = HttpProxyClient.Parse(Help.GetProxy())
                    End If
                    If Me.ComboBox1.Text = "SOCKS-4" Then
                        httpRequest.Proxy = Socks4ProxyClient.Parse(Help.GetProxy())
                    End If
                    If Me.ComboBox1.Text = "SOCKS-5" Then
                        httpRequest.Proxy = Socks5ProxyClient.Parse(Help.GetProxy())
                    End If
                    httpRequest.ConnectTimeout = CInt(Me.NumericUpDown2.Value) * 1000
    Dim postData As String = ""
                    Dim tempCookies As New CookieContainer
                    Dim encoding As New UTF8Encoding
                    Dim byteData As Byte() = encoding.GetBytes(postData)
                    Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("url"), HttpWebRequest)
                    postReq.Method = "POST"
                    postReq.KeepAlive = True
                    postReq.CookieContainer = tempCookies
                    postReq.ContentType = "application/x-www-form-urlencoded"
                    postReq.Referer = "url"
                    postReq.UserAgent = "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14"
                    postReq.ContentLength = byteData.Length
                    Dim postreqstream As Stream = postReq.GetRequestStream()
                    postreqstream.Write(byteData, 0, byteData.Length)
                    postreqstream.Close()
                    Dim postresponse As HttpWebResponse
                    postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
                    tempCookies.Add(postresponse.Cookies)
                    logincookie = tempCookies
                    Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
                    Dim thepage As String = postreqreader.ReadToEnd
    

    Monday, December 4, 2017 11:21 AM
  • Hi,

    I can not understand what do you mean about convert the first code to the second, what do you want to do? Sorry I can not find any connection between them, why do you want to convert it?

    And what is the error with you when converting?

    How do you use this code? Maybe you can provide a simple complete demo.

    Regards,

    Stanly


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Edited by Stanly Fan Monday, December 11, 2017 9:13 AM
    Monday, December 11, 2017 9:12 AM