...

View Full Version : vb get request problem



thegreatone2176
02-23-2005, 03:42 AM
here is my 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?

aman
02-23-2005, 04:45 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum