URL - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Web Features : Web Page Access : URL package : URL/Download

URL

  

Download

  

download data specified by a URL to a file

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Download( url, destination, options )

Parameters

url

-

string specifying the URL from which to request data

destination

-

(optional) file or directory to which the data should be written

options

-

one or more options as specified below

Options

• 

cafile=string

  

A certificate file to use when authenticating the server. Maple includes a certificate file containing certificates for the major Certificate Authorities.

• 

mode=one of text or binary

  

Specifies whether the reply data should be treated as a string (mode=text) or as an Array with data type integer[1] (mode=binary). This is only supported by the http and https schemes. FTP transfers are always treated as binary.

• 

output=list or one of filename, headers, or size

  

A list of one or more of the symbols filename, headers, and size, or one of the symbols filename, headers, or size. The output will be an expression sequence with values corresponding to the specified keywords. The meaning of the symbols is as follows:

  

filename is the file name to which the downloaded data was written.

  

headers refers to the http (and https) header received from the server. It is not supported for URLs with the ftp scheme. It is returned as a table of strings.

  

size refers to the size (in bytes) of the downloaded data. It is returned as an integer.

  

This option is only valid with http and https schemes. The default is filename.

• 

password=string

  

The password for authentication. This supersedes any password included in url directly.

• 

proxy=string

  

A URL for a proxy server. This should include the protocol, host, and port number (if not default), For example, to connect to an HTTP proxy myproxy on port 3421, use proxy=http://myproxy:3421.

• 

proxypassword=string

  

Password to use for authentication against the proxy specified by the proxy option.

• 

proxyuser=string

  

username to use for authentication against the proxy specified by the proxy option.

• 

redirections=integer

  

For HTTP transfers, the number of times Maple should follow a redirect response (HTTP status 3xx) before giving up. The default is 0, meaning redirects are not followed.

• 

requestheaders=list(string) or table

  

A list of strings and equations of strings that will be added to the http header that is sent as part of the request.

• 

responseheaders=list(string)

  

A list of strings specifying header fields to be returned. This only has an effect if headers is specified in the output option. If this option is not given, all received headers will be returned.

• 

timeout=posint

  

The number of seconds to wait before aborting the transfer. The default is infinity (in other words, no timeout).

• 

user=string

  

The user name for authentication. This supersedes any user name included in url directly.

• 

verify=truefalse

  

Specifies whether Maple should authenticate the identity of the server by verifying its SSL certificate against a list of verified Certificate Authorities. The default is true. This option is only valid when using https.

Description

• 

The Download command fetches data from the address specified in url and saves it to a file.

• 

If file is specified and a file with this name does not exist in the current directory, the data is saved to this filename.

• 

If file is specified and corresponds to an existing file, the data is saved to a temporary filename in the same directory.

• 

If file is specified and corresponds to an existing directory, the data is saved to a temporary filename in that directory.

• 

If file is not specified, the data is saved to a temporary filename in the current directory.

  

The Download command uses a GET request to fetch the remote URL. To use other HTTP schemes or provide additional configuration details such as login credentials or proxy settings, see the URL package.

• 

The current implementation of Download is not secure. Between generating the unique filename and creating the file, another process may be able to create a file with the same name. By doing so, the other process can read information from or write information into the file.

Examples

URL:-Downloadhttp://www.maplesoft.com/:

URL:-Downloadhttps://www.maplesoft.com/images2015/resources/Maple/Maple_2015_logo.jpg,MapleLogo.jpg

Compatibility

• 

The URL[Download] command was introduced in Maple 2019.

• 

For more information on Maple 2019 changes, see Updates in Maple 2019.

• 

The URL[Download] command was updated in Maple 2020.

• 

The cafile, password, proxy, proxypassword, proxyuser, redirections, requestheaders, responseheaders, timeout, user and verify options were introduced in Maple 2020.

• 

For more information on Maple 2020 changes, see Updates in Maple 2020.

See Also

URL

URL,Get

URL,Post