WGET

The WGET function retrieves one or more URL files and saves them to a local directory.

This routine is written in the IDL language. Its source code can be found in the file wget.pro in the lib subdirectory of the IDL distribution.

Example

IDL> WGET('http://www.google.com/index.html',FILENAME='test.html')

C:\test.html

Syntax

Result = WGET( URL [, /BUFFER] [DIRECTORY=string] [FILENAME=string] [, /STRING_ARRAY] )

Return Value

By default, WGET returns a string (or string array) containing the full path(s) to the downloaded file(s).

If /BUFFER is set then WGET returns a byte array containing the contents of the URL file.

If /STRING_ARRAY is set then WGET returns a string array containing the contents of the URL file.

Arguments

URL

A scalar string or string array containing the URL of the file(s) to be downloaded.

Keywords

BUFFER

Set this keyword to return a byte array containing the contents of the URL file. This keyword can not be used with multiple URLs. If this keyword is set then the FILENAME keyword is ignored.

DIRECTORY

Set this keyword to a scalar string containing the local directory where the files should be saved. If DIRECTORY is not specified then the current working directory is used.

Note: If FILENAME contains a full path then the DIRECTORY keyword should not be used.

FILENAME

Set this keyword to a scalar string or string array containing the local file name(s) where the URL(s) should be saved. If multiple URLs are specified then FILENAME must have the same number of elements. If FILENAME is not specified then WGET will use the actual file name at the end of the URL.

STRING_ARRAY

Set this keyword to return a string array containing the contents of the URL file. This keyword can not be used with multiple URLs. If this keyword is set then the BUFFER and FILENAME keywords are ignored.

Version History

8.5

Introduced

See Also

HttpRequest::Get