From Xojo Documentation
Used to send and receive data via the HTTP 1.0 protocol.
|If you need HTTP 1.1 support, use Xojo.Net.HTTPSocket instead.|
Use the HTTPSocket class to send and receive data via the HTTP protocol. Since this is a subclass of the TCPSocket class, all the standard socket APIs are also available. To perform secure communications (via HTTPS), use the HTTPSecureSocket class instead. It is otherwise identical, except that it is subclassed from SSLSocket instead of TCPSocket. This makes all the options for encrypted communications available to HTTPSecureSocket objects.
If you use a constructor in a subclass of HTTPSocket, you must call the super class's constructor in your subclass's constructor. The subclass fail when you try to download.
When using the optional Timeout parameter of the Get or GetHeaders methods the page will be received or posted in a synchronous manner. That is, your app will wait until the page has been received or posted before it proceeds. If Timeout is set to zero, the socket will wait indefinitely or until it receives an error.
To use synchronous mode, pass the optional parameter. For example,
When using synchronous mode, you can set the Yield property to True to tell the socket to yield time to other events and code to execute while waiting. Simply insert a statement such as
to allow background processes to execute while waiting.
Web apps running on Xojo Cloud first have to use the FirewallPort class to open the port used to connect to an outside web server.
The following example retrieves the specified URL synchronously:
For asynchronously transfers you need to subclass HTTPSocket, call get without timeout parameter and get result in HTTPSocket.PageReceived event.
The following example posts a simple form:
Dim socket1 As New HTTPSocket
// create and populate the form object
form = New Dictionary
form.Value("firstname") = "Bob"
form.Value("lastname") = "Brown"
// setup the socket to POST the form
To send one or more cookies with an HTTP request: