Under Windows and vb SSPI is your "friend" !

[EMAIL PROTECTED] wrote:

I wrote an vb script which GETs and POSTs to http urls using the winsock in visual basic..

is there anyway at all I can do the same thing for https urls ?

can openssl help ?

prem

please see below for the code that I'm using now

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

Function called for establishing the connection:
================================================

Private Sub cmdGet_Click()
Dim tmp_port As Integer
Dim chk As Integer
Dim tmp_str As String
    Dim ret_chr As String

tmp_port = Val(Text2.Text)
Text4.Text = ""
socket_hdl = modWinsock.socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
'MsgBox socket_hdl
'MsgBox socket_hdl
If Val(socket_hdl) < 0 Then
    MsgBox "Socket problem"
Else

connection_hdl = vbConnect(socket_hdl, Text1.Text, tmp_port)
'MsgBox connection_hdl
If (connection_hdl = 0) Then
MsgBox "Successfull Connection"
Else
MsgBox "Connection Unsuccessfull"
End If
ret_chr = vbCrLf
tmp_str = "POST /first/wrt_file.php HTTP/1.0" & vbCrLf _
& "User-Agent: Mozilla/4.0" & vbCrLf _
& "Content-Type: application/x-www-form-urlencoded" & vbCrLf _
& "Content-Length: 12" & vbCrLf & vbCrLf _
& "name=kishore" & vbCrLf
Text3.Text = tmp_str
chk = modWinsock.vbSend(socket_hdl, Text3.Text)
'chk = modWinsock.vbSend(socket_hdl, tmp_str)
If (chk > -1) Then
MsgBox "Message sent successfully. Number of bytes=" & chk
Timer1.Enabled = True
Else
MsgBox "Message not sent"
End If
End If


End Sub


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


Timer Function to check the status of the socket for response:
==============================================================


Private Sub Timer1_Timer() Dim udtRead_fds As fd_set Dim udtWrite_fds As fd_set Dim udtError_fds As fd_set Dim lngRetValue As Long Dim lngBytereceived As Long Dim recv_str As String

udtRead_fds.fd_array(1) = socket_hdl
udtRead_fds.fd_count = 1

udtWrite_fds.fd_array(1) = socket_hdl
udtWrite_fds.fd_count = 1

udtError_fds.fd_array(1) = socket_hdl
udtError_fds.fd_count = 1

lngRetValue = vbselect(0&, udtRead_fds, udtWrite_fds, udtError_fds, 0&)

'MsgBox "out"

If lngRetValue = SOCKET_ERROR Then
'
'If the function returned value of SOCKET_ERROR
'just show a message box with error description
'
MsgBox (Err.LastDllError)
'
ElseIf lngRetValue > 0 Then
'Check for readable sockets
'MsgBox "here"
If udtRead_fds.fd_count > 0 Then
'
'Get the socket handle
lngSocket = udtRead_fds.fd_array(1)
'
'MsgBox "Socket is ready to read"
'
lngByterecived = vbRecv(lngSocket, recv_str)
If lngBytereceived = SOCKET_ERROR Then
MsgBox Err.LastDllError
Else
Text4.Text = Text4.Text & recv_str
Timer1.Enabled = False
End If
End If
End If



End Sub ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]


--
Frédéric Giudicelli
http://www.newpki.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to