Assistance with httprequest
Posted: Thu Nov 25, 2021 12:35 am
I have been unable to get httprequest to work with an exe.
I have written a very simple example I have put together.
It works from a webpage but not in SpiderBasic. Here are the details.
The exe is written in PureBasic. Source code is:
The file is compiled 64-bit using PB 5.73 as cgitest.exe. The compiling format is Windows.
The test html page is saved as cgitest.htm.
The webserver is IIS in Windows 10. The folder bmv10 is set up as a virtual directory, shared, with CGI working.
Using Chrome, http://edu0018486/bmv10/cgitest.htm opens the test page. Clicking on Go shows the result correctly.
(I run other pages and apps from the same folder so I know CGI is working there.)
SpiderBasic is installed in the same folder (bmv10).
The SB program code is:
Pressing F5 opens the SB page but the debug window shows "Error". I have tried variations with no success.
Any ideas?
I have written a very simple example I have put together.
It works from a webpage but not in SpiderBasic. Here are the details.
The exe is written in PureBasic. Source code is:
Code: Select all
If Not InitCGI() Or Not ReadCGI()
End
EndIf
a$="<html>"+#CRLF$
a$+"<head>"+#CRLF$
a$+"<title>Test</title>"+#CRLF$
a$+"</head>"+#CRLF$
a$+"<body>"+#CRLF$
a$+"This is a test"+#CRLF$
a$+"</body>"+#CRLF$
a$+"</html>"+#CRLF$
WriteCGIHeader(#PB_CGI_HeaderContentType,"text/html",#PB_CGI_LastHeader)
WriteCGIString(a$)
The test html page is saved as cgitest.htm.
Code: Select all
<html>
<head>
<title>CGI Test</title>
</head>
<body>
<form action="http://edu0018486/bmv10/cgitest.exe" method="get">
<input type="submit" value="Go">
</form>
</body>
</html>
Using Chrome, http://edu0018486/bmv10/cgitest.htm opens the test page. Clicking on Go shows the result correctly.
(I run other pages and apps from the same folder so I know CGI is working there.)
SpiderBasic is installed in the same folder (bmv10).
The SB program code is:
Code: Select all
Procedure HttpGetEvent(Success, Result$, UserData)
If Success
Debug Result$
Else
Debug "Error"
EndIf
EndProcedure
HTTPRequest(#PB_HTTP_Get,"http://edu0018486/bmv10/cgitest.exe", "", @HttpGetEvent())
Any ideas?