CGI PUREBASIC and external programm (ex. Notepad.exd)

Just starting out? Need help? Post your questions and find answers here.
loulou2522
Enthusiast
Enthusiast
Posts: 552
Joined: Tue Oct 14, 2014 12:09 pm

CGI PUREBASIC and external programm (ex. Notepad.exd)

Post 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?
User avatar
Kiffi
Addict
Addict
Posts: 1504
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: CGI PUREBASIC and external programm (ex. Notepad.exd)

Post 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).
Hygge
loulou2522
Enthusiast
Enthusiast
Posts: 552
Joined: Tue Oct 14, 2014 12:09 pm

Re: CGI PUREBASIC and external programm (ex. Notepad.exd)

Post 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.
Post Reply