URLConnection.Send
From Xojo Documentation
Supported for all project types and targets.
Asynchronously sends a request using an HTTP method such as GET or POST. Results appear in the ContentReceived event. Send can be used to send both standard "http" and secure "https" requests.
Supported for all project types and targets.
Asynchronously sends a request using an HTTP method such as GET or POST and returns (downloads) the output in file. The downloaded file is available in the FileReceived event. Send can be used to send both standard "http" and secure "https" requests.
Notes
The timeout is in seconds and currently can be a maximum of 60 seconds (75 on macOS). A connection that times out will raise the Error event.
You can view the timeout length on macOS with this Terminal command:
sysctl net.inet.tcp.keepinit
You can change it using this command (specify the value in milliseconds):
sysctl net.inet.tcp.keepinit=30000
Standard Method Definitions
GET and POST are most commonly used, but there are other methods as well. For example, to get just the headers you can use the HEAD method. The full list of methods is available on the W3 HTTP/1.1 Method Definitions page.
Sample Code
Sends a request. The ContentReceived event is called with the response:
Sends a GET request, saving (downloading) the response to a file sent to the FileReceived event:
MyConnection.Send("GET", "http://127.0.0.1:8080/GetData", outputFile)
To make a secure request, use "https" in the URL:
MyConnection.Send("GET", "https://www.mydomain.com/GetData", outputFile)