Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter TwelveInternet Functions (continued)

HTTPGetFile Function

Overview

The HTTPGetFile function retrieves data from a specified URI and places it into a file.

Syntax/Parameters

Syntax

int = HTTPGetFile ( [handle hHTTP], string uri, string filename, [dword flags] );

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 containing a valid URI or path/query. If no handle is supplied, it must contain a full URI with a scheme HTTP or HTTPS. The URI can contain query information but cannot contain multi-part requests (POST type HTTP).

filename

A string specifying a destination filename.

flags

An optional dword which specifies flags and options. The options can be ORed together using the bitwise OR ‘|’ operator. See Remarks below.

Return Value

A int containing the result of the function as the HTTP response code or a formatted error code. The normal response code is 200 for success (or ‘OK’),

Note that a ‘not found’ or bad URI may still return string data and may not set an error in the response code. In many cases the ISP may return a search page or other link information with a successful status code.

The error code can also refer to the ability to create or access the destination file.

Remarks

A page with the content ‘not found’ or ‘bad URI’ may still return file data depending on the Internet service provider.

The HTTPGetFile function uses the HTTP “GET” method which means if the server expects a post the function will not operate properly.

Using a connection handle speeds operation if multiple requests are to be made to the same authority and domain.

The port used will be either 80 or 443 and is automatically determined based on the scheme (http or https) used in the uri parameter or the connection handle.

The flags parameter allows the specification of the following bitwise options:

HTTP_GET_FILE_NO_CACHE — When set to indicates that internal cache should be flushed for the specified URI.

HTTP_GET_FILE_NO_PROGRESS — When set, if a progress display window is open, it will not be updated for status. HTTP functions by default will update status on the second line of the progress window.

Related Functions

Platform Support

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

Legato IDE, Legato Basic