Results 1 to 2 of 2

Thread: how can i add multi proxy to this

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    1

    how can i add multi proxy to this

    this is the project
    http://www.vbforums.com/showthread.php?334645-Winsock-Making-HTTP-POST-GET-Requests

    and now here is the code.

    Code:
    Private Sub Command2_Click()
      Dim eUrl As URL
        'winsock.Close
        Dim strMethod As String
        Dim strData As String
        Dim strPostData As String
        Dim strHeaders As String
            Dim arr() As String
        Dim strHTTP As String
        Dim x As Integer, ll As Integer
         For xx = 0 To List1.ListCount - 1
        strPostData = ""
        strHeaders = ""
        strMethod = cboRequestMethod.List(cboRequestMethod.ListIndex)
               
        'If blnConnected Then Exit Sub
    
    
        ' get the url
        eUrl = ExtractUrl(txtUrl.Text)
        
      '  If eUrl.Host = vbNullString Then
           ' MsgBox "Invalid Host", vbCritical, "ERROR"
        
          '  Exit Sub
        'End If
    
    
    arr = Split(List1.List(xx), ":")
    Text1.Text = arr(0)
    Text2.Text = arr(1)
    Text3.Text = Text3.Text & arr(0) & ":" & arr(1) & vbCrLf
    On Error Resume Next
        ' configure winsock
        winsock.Protocol = sckTCPProtocol
       ' winsock.RemoteHost = eUrl.Host
        winsock.RemoteHost = arr(0)
    winsock.RemotePort = arr(1)
    
        If eUrl.Scheme = "http" Then
            If eUrl.Port > 0 Then
                winsock.RemotePort = eUrl.Port
            Else
                winsock.RemotePort = arr(1)
            End If
        ElseIf eUrl.Scheme = vbNullString Then
            winsock.RemotePort = arr(1)
        Else
           ' MsgBox "Invalid protocol schema"
        End If
    
        ' build encoded data the data is url encoded in the form
        ' var1=value&var2=value
        strData = ""
        For x = 0 To txtVariableName.Count - 1
            If txtVariableName(x).Text <> vbNullString Then
            
                strData = strData & URLEncode(txtVariableName(x).Text) & "=" & _
                                URLEncode(txtVariableValue(x).Text) & "&"
            End If
        Next x
        
        If eUrl.Query <> vbNullString Then
            eUrl.URI = eUrl.URI & "?" & eUrl.Query
        End If
        
        ' check if any variables were supplied
        If strData <> vbNullString Then
            strData = Left(strData, Len(strData) - 1)
            
            
            If strMethod = "GET" Then
                ' if this is a GET request then the URL encoded data
                ' is appended to the URI with a ?
                If eUrl.Query <> vbNullString Then
                    eUrl.URI = eUrl.URI & "&" & strData
                Else
                    eUrl.URI = eUrl.URI & "?" & strData
                End If
            Else
                ' if it is a post request, the data is appended to the
                ' body of the HTTP request and the headers Content-Type
                ' and Content-Length added
                strPostData = strData
                strHeaders = "Content-Type: application/x-www-form-urlencoded" & vbCrLf & _
                             "Content-Length: " & Len(strPostData) & vbCrLf
                             
            End If
        End If
                
        ' get any aditional headers and add them
       
          
            
    For x = 0 To txtHeaderName.Count - 1
            If txtHeaderName(x).Text <> vbNullString Then
            
                strHeaders = strHeaders & txtHeaderName(x).Text & ": " & _
                                txtHeaderValue(x).Text & vbCrLf
            End If
        Next x
    
        ' clear the old HTTP response
        txtResponse.Text = ""
        
        ' build the HTTP request in the form
        '
        ' {REQ METHOD} URI HTTP/1.0
        ' Host: {host}
        ' {headers}
        '
        ' {post data}
    
      
        strHTTP = strMethod & " " & eUrl.URI & " HTTP/1.1" & vbCrLf
        strHTTP = strHTTP & "Host: " & eUrl.Host & vbCrLf
        strHTTP = strHTTP & strHeaders
        strHTTP = strHTTP & vbCrLf
        strHTTP = strHTTP & strPostData
    
        txtRequest.Text = strHTTP
        
        winsock.Connect
      Next xx
        ' wait for a connection
        While Not blnConnected
            DoEvents
            
    
        Wend
        
        ' send the HTTP request
        winsock.SendData strHTTP
    
    
    End Sub

    as u can se i added the
    Code:
     For xx = 0 To List1.ListCount - 1
    list1 has proxies and now am trying to send the request out using each proxy how ever it sends out request with single ip

  2. #2
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,608

    Re: how can i add multi proxy to this

    Thread closed by Brad Jones, Admin. PM sent to original poster (OP).
    Have you given out your reputation points today? Select the Rate This Post link to give points for good posts!
    -------------------------------------------------------------
    Brad! Jones
    Lots of Software, LLC
    (I wrote: C Programming in One Hour a Day) (Dad Jokes Book) (Follow me on Twitter)

    --------------------------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width