Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5a

Application v 5.23b

  

 

Chapter TwelveInternet Functions (continued)

HTTPRawRequest Function

Overview

The HTTPRawRequest function can be used to create an HTTP request that is customized. This function allows for usage of both standard and non-standard HTTP verbs as well as any body formats and additional headers.

Syntax/Parameters

Syntax

string = HTTPRawRequest ( [handle hHTTP], string uri, [string verb],
                      [string headers], [string body], [handle result])

Parameters

hHTTP

An optional handle specifying an existing HTTP connection to employ for the transaction. If a handle is used, the HTTP type and authority (domain) must match for the supplied uri parameter.

uri

A string as a valid URI (which must contain the scheme HTTP or HTTPS) or a path with an optional query. The URI can contain query information but cannot contain multi-part requests. The uri can contain just the path and an optional query when an HTTP connection handle is used.

verb

An optional string indicating the HTTP verb used to make the request. the default is “GET”.

headers

An optional string specifying any additional headers to the request. These headers must be in proper HTTP format. The application may attach cookies to the request if there are cookies for the domain.

body

An optional string specifying the body of the request.

result

An optional handle value for a File Object to receive the response data.

Return Value

A string containing the reply data. On error the string will be empty. Use the GetLastError function to get the formatted error code or the HTTP response code and GetLastErrorMessage to return details of the error.

If a response file is provided, the string will contain “(response in file)”.

Note that a non-empty string does not indicate success. If the post reaches a server and the page is not found or the parameters are incorrect, the server may respond with an error page returned as the string.

Remarks

The HTTPRawRequest function allows for complex or different formats that may not be supported by other functions. For example, the HTTPPost function posts only in multipart form data format.

Reply or response data can be captured in string form or in the form of a file. If the data may exceed 2MB, a file should be employed.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic

Page revised 2024-08-19