HTTPREQUEST() Not Working
Posted: Wed Apr 13, 2016 6:53 pm
I have the following code on a Purebasic program (CGI) and I am using Abyss web server. I know the Purebasic-CGI works because I get the correct reply on a regular webpage http://127.0.0.1/cgi-bin/test.exe.
When I do a httprequest() on Spiderbasic I get an HTTP: Request error
Please help!!
Purebasic Code
Spiderbasic Code
When I do a httprequest() on Spiderbasic I get an HTTP: Request error
Please help!!
Purebasic Code
Code: Select all
;Initialize CGI and make sure we are able to read request
If Not InitCGI() Or Not ReadCGI()
End
EndIf
;Create Body of page
jsonresponse.s = "{'name':'This should work'}"
WriteCGIHeader("Access-Control-Allow-Origin", "*")
WriteCGIHeader(#PB_CGI_HeaderContentType, "text/html", #PB_CGI_LastHeader)
WriteCGIString(jsonresponse)
Code: Select all
; Test interaction between SpiderBasic And Purebasic CGI
theurl.s = "http://127.0.0.1/cgi-bin/test.exe"
Procedure HttpGetEvent(Success, Result$, UserData)
If Success
Debug Result$
Else
Debug "HTTPRequest(): Error"
EndIf
EndProcedure
; Get the content of this file, and display it in the debug window
Debug "Sending Request to " + theurl
;
HTTPRequest(#PB_HTTP_Post, theurl, "", @HttpGetEvent())