So, ich hab mal ein kleines Beispiel gebaut, mit dem jeder mal mein Problem nachvollziehen kann.
Also in der PB-Datei steht:
Code: Alles auswählen
#Window_4 = 4
#Gadget_8 = 8
;Anfang fuer Postuebergabe
#INTERNET_OPEN_TYPE_DIRECT = 1
#HTTP_ADDREQ_FLAG_ADD = $20000000
#HTTP_ADDREQ_FLAG_REPLACE = $80000000
#INTERNET_FLAG_SECURE2 = 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
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)
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))
Debug "Last Error: " + Str(GetLastError_())
If send_handle
Debug "Send_Handle: " + Str(send_handle)
Repeat
InternetReadFile_(request_handle,@buffer,1024,@bytes_read)
Debug buffer
result = result + Left(buffer,bytes_read)
buffer = Space(1024)
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
Procedure.s ShowWebUpdates()
;Seite mit POST-Variablen aufrufen und in Gadget schreiben
Define post.HttpPostStructure
post\host.s = "www.msjones.de"
post\get_url.s = "posttest.php";"startak.php"
post\post_data.s = "language=chinese_simplified"
Send_HTTP_Post(@post)
OpenWindow(#Window_4, 0, 0, 1024, 768, "Online Updates", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
SystemParametersInfo_(#SPI_GETWORKAREA,0,rect.RECT,0)
xh=WindowHeight(#Window_4)-20
xw=WindowWidth(#Window_4)
x=0
CreateGadgetList(WindowID(#Window_4))
WebGadget(#Gadget_8, 0, 0, xw, xh, "")
SetGadgetItemText(#Gadget_8, #PB_Web_HtmlCode, post\result.s)
Repeat
z=WaitWindowEvent()
If z = #PB_Event_CloseWindow And EventWindow() = #Window_4
x=1
EndIf
If z = #WM_SIZE
xh=WindowHeight(#Window_4)-20
xw=WindowWidth(#Window_4)
ResizeGadget(#Gadget_8,-1,-1,xw,xh)
EndIf
Until x=1
CloseWindow(#Window_4)
EndProcedure
ShowWebUpdates()
Die posttest.php sieht so aus:
Code: Alles auswählen
<?PHP
echo "<b>Get:</b><br>";
foreach ($_GET as $key => $value)
{
echo " ".$key.": ".$value."<br>";
}
echo "<br>";
echo "<b>Post:</b><br>";
foreach ($_POST as $key => $value)
{
echo " ".$key.": ".$value."<br>";
}
?>
Wenn ich da Programm jetzt normal kompiliere, funktioniers wunderbar.
Aber als Unicode-Executeable hab ich ungefähr sowas als ausgabe: "????????????????????????›???????".
Das muß doch irgendwie zu machen sein, daß das auch als Unicode-Executable funktioniert.
Kann denn keiner helfen?