[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: receiving http Post/Push data


On 7/8/24 12:26, Bruce Steers wrote:

I have in my gambas program a method that connects to a url that is a gb.web cgi script

this url when opened checks the QUERY_STRING and returns data depending on the arg.

but i also want to upload some text data to it.

I have this function...
Public Sub btnUpload_Click()

   Dim sRes As String
   Dim s As String = File.LoadArchive(File.SetExt(ESettings.Path, "zx"), True)

   With $hTp = New HttpClient As "HTP"
     .URL = $sHost &/ $sScoreAppPath & "?submit"
     .Post("text/plain", s)
    ' .Push("text/plain", s)  ' tried this way too
   End With

End

Then on the server-side the cgi-script runs and it detects the "submit" but i cannot figure out how to access the sent data on the server.
I looked at all the CGI[Key] keys, it's not there , Content-Length: is filled and correct but wheres the text data that was sent?

Cheers for any advice
BruceS



Request.Post ?

"Request.Post only deals with application/x-www-form-urlencoded and multipart/form-data" content type.

For other content type (like application/json), you must read it manually from the standard input."

So you'll need to set the content-type to one of the above, when sending the Post, to read it in Request.Post, or
sPostData = Read #File.In Request.ContentLength '(I think.)


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----


Follow-Ups:
Re: receiving http Post/Push dataBruce Steers <bsteers4@xxxxxxxxx>
References:
receiving http Post/Push dataBruce Steers <bsteers4@xxxxxxxxx>