HTTP/Get - Help

HTTP

 Get
 Retrieve a data from a URL using the HTTP GET method

 Calling Sequence Get(URI, options)

Parameters

 URI - host, port, and URL path of the form http://host:port/path/to/file?query; the uniform resource identifier

Options

 • forcemode=name

either text or binary this forces the transfer to be done in the given mode regardless of the Content-Type reported by the server.

list of header values; duplicate values will be combined into a single comma-separated list.

 • timeout=posint

the number of seconds to wait for data before timing out.

Description

 • The Get command retrieves whatever information (in the form of an entity) is identified by the Request-URI.
 • Currently, only text content types are supported.
 • Get returns a sequence (code, content, headers) with code set to the return code sent by the server, content containing the body of the server response and the headers as a table.

Examples

 > $\mathrm{status},\mathrm{data},\mathrm{headers}≔\mathrm{HTTP}:-\mathrm{Get}\left("http://www.maplesoft.com/",\mathrm{timeout}=100\right):$
 > $\mathrm{HTTP}:-\mathrm{Code}\left(\mathrm{status}\right)$
 ${"OK"}$ (1)
 > $\mathrm{type}\left(\mathrm{data},'\mathrm{string}'\right)$
 ${\mathrm{true}}$ (2)
 > ${\mathrm{data}}_{1..72}$
 ${" (3)
 > $\mathrm{type}\left(\mathrm{headers},'\mathrm{table}'\right)$
 ${\mathrm{true}}$ (4)
 > ${\mathrm{headers}}_{"Content-Type"}$
 ${"text/html; charset=utf-8"}$ (5)
 > $\mathrm{status},\mathrm{data},\mathrm{headers}≔\mathrm{HTTP}:-\mathrm{Get}\left("http://www.maplesoft.com/common/images/logo.jpg"\right):$
 > ${\mathrm{headers}}_{"Content-Type"}$
 ${"image/jpeg"}$ (6)
 > $\mathrm{data}$
 $\left[\begin{array}{c}{\mathrm{1 .. 5446}}{\mathrm{Array}}\\ {\mathrm{Data Type:}}{{\mathrm{integer}}}_{{1}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\right]$ (7)
 > $\mathrm{HTTP}:-\mathrm{Get}\left("http://0.0.0.0"\right)$

Compatibility

 • The HTTP[Get] command was introduced in Maple 15.