Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    vb get request problem

    here is my code....

    Code:
    Private Sub cmdlog_Click()
        Open "C:/send.txt" For Append As #1
            Print #1, strsend
        Close #1
    End Sub
    
    Private Sub cmdstart_Click()
        sock.Connect "the ip", 80
    End Sub
    
    Private Sub Form_Load()
        Dim strsend
    End Sub
    
    Private Sub sock_connect()
       sock.SendData "GET index.php HTTP/1.1" & vbCrLf & vbCrLf
    End Sub
    
    Private Sub sock_DataArrival(ByVal bytesTotal As Long)
        sock.GetData strsend
        Label1 = strsend
        
    End Sub
    
    Private Sub sock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
        MsgBox "Socket Error " & Number & ": " & Description
        sock.Close
        sock.Listen
    End Sub
    now my problem is that all i get back from the server is 400 bad request and to make it worse a textbox,listbox, and a label wont show english they just show ???? across the screen so i run ethreal to view the packets.

    i have tried all variations of

    sock.SendData "GET index.php HTTP/1.1" & vbCrLf & vbCrLf
    sock.SendData "GET / HTTP/1.1" & vbCrLf & vbCrLf
    sock.SendData "GET HTTP/1.1" & vbCrLf & vbCrLf

    none of them work
    any suggestions?

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try adding the 'Host' field to your request.. You'll have to convert this to VB.

    "GET index.php HTTP/1.0\r\n Accept: */*\r\n Host: www.somesite.com \r\n\r\n";

    There's plenty of resources around to learn about HTTP request formatting, google for some.


  •  

    Posting Permissions

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