POST HTTP

DOIDO.NNF 18/06/2010 15:22:08
#345215
opa
alguem pode me ajudar
preciso postar dados em uma pagina asp
so q nao posso usar inet
ai estou usando o seguinte codigo
 
Public Function PostInfo(server As String, script As String, PostData As String) As String

Dim hInternetOpen As Long
Dim hInternetConnect As Long
Dim hHttpOpenRequest As Long
Dim bRet As Boolean
Dim bDoLoop As Boolean
Dim sReadBuffer As String * 4096
Dim lNumberOfBytesRead As Long
Dim sBuffer As String
Dim sHeader As String
Dim lPostDataLen As Long

hInternetOpen = 0
hInternetConnect = 0
hHttpOpenRequest = 0

[ô]Use registry access settings.
Const INTERNET_OPEN_TYPE_PRECONFIG = 0

hInternetOpen = InternetOpen([Ô]Microsoft Internet Explorer[Ô], INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)

If hInternetOpen <> 0 Then
[ô]Type of service to access.
Const INTERNET_SERVICE_HTTP = 3
Const INTERNET_DEFAULT_HTTP_PORT = 80
[ô]Change the server to your server name
hInternetConnect = InternetConnect(hInternetOpen, server, INTERNET_DEFAULT_HTTP_PORT, vbNullString, [Ô]HTTP/1.0[Ô], INTERNET_SERVICE_HTTP, 0, 0)

If hInternetConnect <> 0 Then
[ô]Brings the data across the wire even if it locally cached.

hHttpOpenRequest = HttpOpenRequest(hInternetConnect, [Ô]POST[Ô], script, [Ô]HTTP/1.1[Ô], vbNullString, 0, INTERNET_FLAG_RELOAD, 0)
If hHttpOpenRequest <> 0 Then
sHeader = [Ô]Content-Type: application/x-www-form-urlencoded[Ô]
lPostDataLen = Len(PostData)
bRet = HttpSendRequest(hHttpOpenRequest, sHeader, Len(sHeader), PostData, lPostDataLen)

bDoLoop = True
Do While bDoLoop
sReadBuffer = vbNullString
bDoLoop = InternetReadFile(hHttpOpenRequest, sReadBuffer, Len(sReadBuffer), lNumberOfBytesRead)
sBuffer = sBuffer & Left(sReadBuffer, lNumberOfBytesRead)
If Not CBool(lNumberOfBytesRead) Then bDoLoop = False
Loop




bRet = InternetCloseHandle(hHttpOpenRequest)
End If
bRet = InternetCloseHandle(hInternetConnect)
End If
bRet = InternetCloseHandle(hInternetOpen)

DoEvents
End If

O problema é q o site as vezes fica lento, e acaba travando a resposta
alguem tem uma dica?
KERPLUNK 07/01/2011 10:43:34
#361520
Amigo, o melhor mesmo é vc usar o componente webbrowser para seu caso... vc simplesmente passa para ele a URL já montada e verifica o resultado...
Tópico encerrado , respostas não são mais permitidas