Kleines PHP Beispiel (Keinenfalls so Produktiv Nutzen)
This commit is contained in:
parent
4adbb850f3
commit
798e1260af
1 changed files with 34 additions and 1 deletions
|
@ -20,7 +20,7 @@ XIncludeFile "lweb.pbi"
|
|||
|
||||
Define counter, v_lweb_srv_stop
|
||||
|
||||
lhs_web::set_config(lhs_web::#conf_port, "8099")
|
||||
lhs_web::set_config(lhs_web::#conf_port, "8096")
|
||||
;lhs_web::set_config(lhs_web::#conf_binding, "127.0.0.1")
|
||||
lhs_web::set_config(lhs_web::#conf_binding, "0.0.0.0")
|
||||
|
||||
|
@ -80,10 +80,43 @@ Procedure.s Formular_Test(Map Header.s(), ContentData.s)
|
|||
|
||||
EndProcedure
|
||||
|
||||
Procedure.s Php_Test(Map Header.s(), ContentData.s)
|
||||
Define *Text, Php
|
||||
Define.s Execute, Phpresult, Encoded, ZumSenden
|
||||
NewMap Response.s()
|
||||
|
||||
Execute = lhs_web::get_config(lhs_web::#conf_basedir) + Header(lhs_web::#http_head_request)
|
||||
Debug "To Execute:" + Execute
|
||||
Php = RunProgram("php", Execute, "", #PB_Program_Open | #PB_Program_Read)
|
||||
Phpresult = ""
|
||||
If Php
|
||||
While ProgramRunning(Php)
|
||||
If AvailableProgramOutput(Php)
|
||||
Phpresult + ReadProgramString(Php) + #CRLF$
|
||||
EndIf
|
||||
Wend
|
||||
CloseProgram(Php) ; Schließt die Verbindung zum Programm
|
||||
EndIf
|
||||
*Text = UTF8(Phpresult)
|
||||
Debug "Unencoded:"+PeekS(*Text, -1 , #PB_UTF8)
|
||||
Encoded = Base64Encoder(*Text, MemorySize(*Text))
|
||||
Debug "Encoded: " + Encoded
|
||||
Response(lhs_web::#cha_R_ResponseContentType) = lhs_web::#response_string
|
||||
Response(lhs_web::#cha_R_StringBase64) = Encoded
|
||||
Response(lhs_web::#cha_R_ResponseType) = lhs_web::mimetype("html")
|
||||
Response(lhs_web::#cha_R_http_head_status) = "200 OK"
|
||||
ZumSenden = lhs_web::MapStringToJSONString(Response())
|
||||
Debug "ZumSenden: " + ZumSenden
|
||||
ProcedureReturn ZumSenden
|
||||
EndProcedure
|
||||
|
||||
|
||||
lhs_web::register_client_handler("/server/show_client_headers", @Sample_Header(),lhs_web::#handler_proto_get, lhs_web::#handler_sub)
|
||||
|
||||
lhs_web::register_client_handler("/post_test", @Formular_Test(),lhs_web::#handler_proto_post, lhs_web::#handler_sub)
|
||||
|
||||
lhs_web::register_client_handler("php", @Php_Test(),lhs_web::#handler_proto_universal, lhs_web::#handler_type)
|
||||
|
||||
;*
|
||||
;* Initialisierung Netzwerk
|
||||
;*
|
||||
|
|
Loading…
Reference in a new issue