Xojo.Net.HTTPSocket.Send

From Xojo Documentation

Method

Xojo.Net.HTTPSocket.Send(method As Text, URL As Text)

Supported for all project types and targets.

Asynchronously sends a request using an HTTP method such as GET or POST. Results appear in the PageReceived event. Send can be used to send both standard "http" and secure "https" requests.


Method

Xojo.Net.HTTPSocket.Send(method As Text, URL As Text, file As Xojo.IO.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

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

Sends a GET request, saving the response to a file:

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

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

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