URLConnection.Send

From Xojo Documentation

Method

URLConnection.Send(method As String, URL As String)

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.


Method

URLConnection.Send(method As String, URL As String, file As FolderItem)

Supported for all project types and targets.

Asynchronously sends a request using an HTTP method such as GET or POST and returns the output in file. The file is available in the FileReceived event. Send can be used to send both standard "http" and secure "https" requests.

Sample Code

Sends a request. The ContentReceived event is called with the response:

MyConnection.Send("GET", "http://127.0.0.1:8080/GetData")

Sends a GET request, saving the response to a file sent to the FileReceived event:

Var outputFile As FolderItem = SpecialFolder.Documents.Child("data.json")
MyConnection.Send("GET", "http://127.0.0.1:8080/GetData", outputFile)

To make a secure request, use "https" in the URL:

Var outputFile As FolderItem = SpecialFolder.Documents.Child("data.json")
MyConnection.Send("GET", "https://www.mydomain.com/GetData", outputFile)

See Also

UserGuide:App Transport Security topic