URLConnection.SendSync
From Xojo Documentation
Supported for all project types and targets.
Synchronously sends a request using an HTTP method such as GET or POST. Results are returned as a String. Send can be used to send both standard "http" and secure "https" requests. The timeout is in seconds.
Supported for all project types and targets.
Synchronously sends a request using an HTTP method such as GET or POST and returns the output in file. The results are saved to the supplied file. Send can be used to send both standard "http" and secure "https" requests. The timeout is in seconds.
Notes
Be aware that calling SendSync can cause your app's UI to "freeze" while it waits for the result. For normal processing you may want to use the asynchronous Send method instead, which calls the ContentReceived or FileReceived events when data is received.
This method raises a RuntimeException if an App Transport Security error occurs on macOS due to using a non-secure URL without the appropriate entry in the plist.
Sample Code
Sends a GET request, saving the response to a file:
MyConnection.SendSync("GET", "http://127.0.0.1:8080/GetData", outputFile, 30)
To make a secure request, use "https" in the URL:
MyConnection.SendSync("GET", "https://www.mydomain.com/GetData", outputFile, 30)