So, ich glaub, jetzt hab ich's soweit, daß es funktioniert.
Die Send_HTTP_Post sieht dann bei mir so aus:
Code: Alles auswählen
Procedure Send_HTTP_Post(*in.HTTPPostStructure)
Protected open_handle.i,connect_handle.i,request_handle.i,send_handle
Protected result.s,headers.s
Protected bytes_read.i,ReturnStatus.i
Protected total_read.i = 0
Protected UserAgent.s = "IDOPOST!"
Protected buffer.s = Space(1024)
;InputStructure
; host.s holding the hostname Do NOT include http:// or any other protocol indicator here
; get_url.s Everything after the hostname of the server
; result.s Holds the result from the CGI/page
; post_data.s the data that should be posted
; result.s holds the reviced html
Debug *in\get_url
Debug *in\host
Debug *in\post_data.s
If *in
open_handle = InternetOpen_(UserAgent.s,#INTERNET_OPEN_TYPE_DIRECT,"","",0)
If open_handle
Debug "Open_Handle: " + Str(open_handle)
connect_handle = InternetConnect_(open_handle,*in\host,#INTERNET_DEFAULT_HTTP_PORT,"","",#INTERNET_SERVICE_HTTP,0,0)
If connect_handle
Debug "Connect_Handle: " + Str(connect_handle)
request_handle = HttpOpenRequest_(connect_handle,"POST",*in\get_url,"","",0,#INTERNET_FLAG_SECURE2,0)
If request_handle
Debug "Request_Handle: " + Str(request_handle)
post_data=AllocateMemory(Len(*in\post_data))
PokeS (post_data,*in\post_data,Len(*in\post_data),#PB_Ascii)
headers.s = "Content-Type: application/x-www-form-urlencoded"+Chr(13)+Chr(10)
HttpAddRequestHeaders_(request_handle,@headers,Len(headers), #HTTP_ADDREQ_FLAG_REPLACE | #HTTP_ADDREQ_FLAG_ADD)
send_handle = HttpSendRequest_(request_handle,"",0,post_data,Len(PeekS(post_data,1024,#PB_Ascii)))
If send_handle
Debug "Send_Handle: " + Str(send_handle)
tempBuffer=AllocateMemory(bytes_read)
Repeat
InternetReadFile_(request_handle,@buffer,1024,@bytes_read)
Debug Str(bytes_read)+": "+buffer
If (bytes_read > 0)
PokeS(tempBuffer,buffer,bytes_read)
Debug "peek" +PeekS(tempBuffer,bytes_read, #PB_UTF8)
result = result + PeekS(tempBuffer,bytes_read, #PB_Ascii)
buffer = Space(1024)
EndIf
Until bytes_read=0
Debug result
*in\result.s = result.s
ReturnStatus = #True
Else
ReturnStatus = -3
EndIf
Else
ReturnStatus = -2
EndIf
Else
ReturnStatus = -1
EndIf
Else
ReturnStatus = 0
EndIf
Else
ReturnStatus = 0
EndIf
If ReturnStatus < 0 Or ReturnStatus = #True
InternetCloseHandle_(open_handle)
EndIf
ProcedureReturn ReturnStatus
;- uncomment the following when you want To get the cookie Data - Not sure If it works Or Not.....
;buffer.s = Space(#MAX_PATH)
;headernum = 0
;length = Len(buffer)
;HttpQueryInfo_(request_handle, #HTTP_QUERY_COOKIE, @buffer, @length, @headernum)
;Debug buffer
EndProcedure
Vielen Dank an alle, die mir bei diesem Problem geholfen haben. Allein wär ich da verzweifelt...