http.geturl — Fetch contents of a URL.
http.geturl
url
[-query POSTdata
] [-headers list of headers
] [-validate [1|0]]
The http.geturl command performs an
HTTP request to the given
and
returns information about the results. This information
is returned as a hash table that can be accessed with the
various h* commands such as hget. The list of keys
returned includes the following, which are set by Hecl.
Also created as keys are the various HTTP headers, such as
connection, content-length, content-type, last-modified,
and so on.
url
binary
: 1 if the data
returned is binary, otherwise 0.
charset
: The charset used for
the returned data.
data
: The returned data.
ncode
: The numeric code of
the response, such as 404, 500, 301, and so on.
status
: The request status -
ok if the request was successfully processed.
The -query
option is used to send
key/value pairs of variables. In order to set random
headers, the -headers
argument is used.
The -validate
option exists to send a
HEAD
request.