I see that there is a method to send a request, and we can set the request method to POST, but how do I set form variables? All the examples I can find set the request content as some JSON, which is great if I need to send JSON to the server - but what if I just need good-old-fashioned form variables?
In the old framework, I would do something like this:
dim s as new HTTPSocket
dim params as new Dictionary
params.value("schema_version") = "1234"
params.value("someVar") = "asdf"
s.SetFormData(params)
Then when I would send the request the form variables would show up correctly on the server end. How do I do the same with the new framework?
Thanks!
That would be necessary to post back fields in the Paypal Listener, which requires HTTP 1.1only Xojo.Net.HTTPSocket
provides.
Would what I used in the FormatSQL with a Web Service blog post work?
I just built the parameters myself and then put it into the RequestContent.
Thanks, Paul - that got me what I needed. For completeness, to translate the old framework approach above to the new framework, I did this:
[code] dim postText as Text = “someVar=1234&schema_version=asdf”
dim postData as xojo.Core.MemoryBlock = Xojo.core.TextEncoding.UTF8.ConvertTextToData(postText)
app.mySocket.SetRequestContent(postData, “application/x-www-form-urlencoded”)
app.mySocket.Send(“POST”, targetURL)[/code]