HTTPSocket.Post
From Xojo Documentation
Asynchronously sends a POST command to the URL. When the page content is received, the HTTPSocket.PageReceived event handler is called with the response available in the content parameter.
Asynchronously sends a POST command to the URL. The response is downloaded directly to the FolderItem.
The HTTPSocket.DownloadComplete event handler is called when the response data has finished downloading.
You need to subclass HTTPSocket (or use AddHandler) so that you can handle the appropriate events.
Supported for all project types and targets.
Synchronously issues a POST command to the URL and returns a String that contains the response. TimeOut is the number of seconds to wait for the result.
If Timeout is set to zero, then there is no timeout period and the socket waits until it receives the page or gets an error.
HTTPSocket.ErrorCode is -1 if the Timeout value is reached.
Supported for all project types and targets.
Synchronously issues a POST command to the URL and downloads the response directly to the FolderItem. When the download has finished, True is returned if successful, False if there was an error. TimeOut is the number of seconds to wait for the result.
HTTPSocket.ErrorCode is -1 if the Timeout value is reached.
Notes
For the synchronous versions of this method, set the HTTPSocket.Yield property to True to allow for background activities while waiting.
Examples
This example does a synchronous POST to a service that returns what you POSTed to it as JSON:
d.Value("Test") = "TestValue"
d.Value("Value2") = "Testing"
Socket.SetFormData(d)
// This service simply returns the post data as the result
Var result As String
result = Socket.Post("http://httpbin.org/post", 30) // Synchronous
result = DefineEncoding(result, Encodings.UTF8)
MessageBox(result)
To do this asynchronous, call Post without a timeout:
d.Value("Test") = "TestValue"
d.Value("Value2") = "Testing"
Socket.SetFormData(d)
// This service simply returns the post data as the result
Socket.Post("http://httpbin.org/post")
The results will be available in the PageReceived event handler in the content parameter.