Das Ganze läuft über HTTP-Post!
Code: Alles auswählen
#INTERNET_OPEN_TYPE_DIRECT = 1
#HTTP_ADDREQ_FLAG_ADD = $20000000
#HTTP_ADDREQ_FLAG_REPLACE = $80000000
#INTERNET_FLAG_SECURE = 0
#INTERNET_SERVICE_HTTP = 3
#INTERNET_DEFAULT_HTTP_PORT = 80
#HTTP_QUERY_COOKIE = 44
Structure HttpPostStructure
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
post_data.s ;the Data that should be posted
result.s ;holds the reviced html
EndStructure
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
connect_handle = InternetConnect_(open_handle,*in\host,#INTERNET_DEFAULT_HTTP_PORT,"","",#INTERNET_SERVICE_HTTP,0,0)
If connect_handle
request_handle = HttpOpenRequest_(connect_handle,"POST",*in\get_url,"","",0,#INTERNET_FLAG_SECURE,0)
If request_handle
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,*in\post_data,Len(*in\post_data))
If send_handle
Repeat
InternetReadFile_(request_handle,@buffer,1024,@bytes_read)
result + Left(buffer,bytes_read)
buffer = Space(1024)
Until bytes_read=0
*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
UserName.s = "User"
Password.s = "PWD"
;Testing
Define HttpPostStructure.HttpPostStructure
HttpPostStructure\host.s = "www.comunio.de"
HttpPostStructure\get_url.s = "login.phtml"
HttpPostStructure\post_data.s = "login="+UserName.s+"&pass="+Password.s+"&action=login&%3E%3E+Login_x=%3E%3E+Login"
Debug Send_HTTP_Post(@HTTPPostStructure)
Debug HttpPostStructure\result.s
habs nicht weiter getestet; will mich da nicht Registrieren.
Ich habe keine Lösung, aber ich bewundere das Problem.