Here is a short example:
Abyss is installed on local computer
D:\Abyss Web Server
I created a folder for the cgi apps
D:\Abyss Web Server\cgi-bin
In Abyss console I selected "Configure" button for default host on port 80
Under "Alias" I added virtual path
/cgi-bin
and real path
D:\Abyss Web Server\cgi-bin
Under "Scripting Parameters" I added a virtual path under Script Path
/cgi-bin
Now I compiled this PB code as "cgitest.exe" with executable format as Console (under compiler options)
and placed it in D:\Abyss Web Server\cgi-bin
Code: Select all
If Not InitCGI() Or Not ReadCGI()
End
EndIf
name$=CGIParameterValue("name")
WriteCGIHeader(#PB_CGI_HeaderContentType,"text/html",#PB_CGI_LastHeader)
WriteCGIString("Hello "+name$)
Open a web browser and type this link
http://localhost/cgi-bin/cgitest.exe?name=Paul
If all is set up correctly your webpage should display
Hello Paul
Now to test with SpiderBasic app, compile this code with SpiderBasic
Code: Select all
;/ Created with PureVision v5.40
;/ Mon, 09 Nov 2015 11:45:45
;/ by Paul Leischow
Define EventID,MenuID,GadgetID,WindowID
;- Window Constants
Enumeration 1
#Window_Main
EndEnumeration
;- Gadget Constants
Enumeration 1
;Window_Main
#Gadget_Main_Text2
#Gadget_Main_Name
#Gadget_Main_OK
EndEnumeration
Procedure.i Window_Main()
If OpenWindow(#Window_Main,158,117,335,84,"CGI Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible)
TextGadget(#Gadget_Main_Text2,15,15,60,15,"Name:")
StringGadget(#Gadget_Main_Name,15,30,230,20,"")
ButtonGadget(#Gadget_Main_OK,255,30,60,20,"OK")
HideWindow(#Window_Main,0)
ProcedureReturn WindowID(#Window_Main)
EndIf
EndProcedure
Procedure HttpGetEvent(Success, Result$, UserData)
If Success
Debug Result$
Else
Debug "HTTPRequest(): Error"
EndIf
EndProcedure
Procedure CloseWindowEvent()
WindowID=EventWindow()
If WindowID=#Window_Main
CloseWindow(#Window_Main)
EndIf
EndProcedure
;- GadgetEvent Loop
Procedure GadgetEvent()
GadgetID=EventGadget()
Select GadgetID
Case #Gadget_Main_OK
HTTPRequest(#PB_HTTP_Get, "/cgi-bin/cgitest.exe?name="+GetGadgetText(#Gadget_Main_Name), "", @HttpGetEvent())
EndSelect
EndProcedure
;- Main Loop
If Window_Main()
BindEvent(#PB_Event_Gadget,@GadgetEvent())
EndIf
I renamed the compiled file "SpiderBasic_Compilation0.html" to "cgitest.html" and placed this file in
D:\Abyss Web Server\htdocs
I also created the folder
D:\Abyss Web Server\htdocs\spiderbasic
D:\Abyss Web Server\htdocs\spiderbasic\libraries
and then copied the JavaScript folder from my C:\SpiderBasic\Libraries\JavaScript
and placed it in D:\Abyss Web Server\htdocs\spiderbasic\libraries\javascript
Now test by opening web browser and typing
http://localhost/cgitest.html
Enter your name and press OK, debug window should display
Hello your name