Page 1 of 1
CGI PUREBASIC and external programm (ex. Notepad.exd)
Posted: Thu Jan 23, 2025 9:11 am
by loulou2522
Hi all,
I would like to be able to launch an executable (e.g. Notepad.exe) from SPIDERBASIC using PUREBASIC CGI. Is it possible. If not, what are the solutions that would allow me to get around the problem?
Re: CGI PUREBASIC and external programm (ex. Notepad.exd)
Posted: Thu Jan 23, 2025 11:04 am
by Kiffi
loulou2522 wrote: Thu Jan 23, 2025 9:11 amIs it possible.
Yes, that is possible. However, you must note that in this case you start Notepad on the
server (the computer that hosts your SpiderBasic site); not on the
client (the computer on which the browser displays your website).
Re: CGI PUREBASIC and external programm (ex. Notepad.exd)
Posted: Sat Jan 25, 2025 12:27 am
by loulou2522
Thank you Kiffi for your reply.
Would it be possible for you to correct these two programmes for me so that I can test them, as I can't do it.
Partie SB
Code: Select all
procedure HttpGetEvent2(Success, Result$, UserData)
If Success
Debug result$
EndIf
EndProcedure
Procedure btn_login_Action2()
Global url.s="https://sxxx/xxx/caressai.exe"
HTTPRequest(#PB_HTTP_Post, url, "",@HttpGetEvent2())
EndProcedure
btn_login_Action2()
Partie PB
Code: Select all
If Not InitCGI() Or Not ReadCGI()
End
EndIf
RunProgram("notepad.exe")
WriteCGIHeader("Access-Control-Allow-Origin", "*") ;<----------- Remove for Final Release !!!!!!;
WriteCGIHeader(#PB_CGI_HeaderContentType,"application/vnd.microsoft.portable-executable",#PB_CGI_LastHeader)
WriteCGIString(user$+"="+resultat$)
The aim is to be able to launch an executable on the server from SB.