httpget
This retrieves a specified document from the HTTP server. This command returns a keyed list.
httpget {{URL url} ?{HEADERS headerList}? ?{AUTH authList}? ?{HTTPS HTTPSList}?
?{TIMEOUT seconds}?} ?{PROXY ?{USER username}? ?{PASS password}?
?{HOST proxyServerMachine}? ?{PORT proxyServerPort}? }? {DEBUG 1}}
-
url
is the URL/web address. For example, www.foo.com or http://foo.com:80/index.html. headerList
is a keyed list of HTTP header settings. For example:{{User-Agent Tcl/Tk} {Content-Type text/xml}}
authList
is a keyed list of user name/password authorization settings:{{SCHEME scheme} {USER user} {PASSWD password}}
-
scheme
is the encryption scheme used to encode the password. For example, basic, or base-64. -
user
is the user name. -
password
is the encrypted password.
-
HTTPSList
is a keyed list of HTTPS security settings to use HTTPs:{CA_FILE cafile} {CA_PATH capath} {CERT_FILE certfile} {PRIVATE_KEY privatekey} {MODE mode}
-
cafile
is the certificate authority file. -
capath
is the certificate authority path. -
certfile
is the certificate file. -
privatekey
is the private key file. -
mode
is the mode of HTTPS authentication.
Modes are:
- None
- Anonymous
- ClientAuth
- ClientServerAuth
-
seconds
is the expiration time in seconds. If the timer expires, httpget returns this code:{STATUS {HTTP/1.1 408 Request Time-out}} {HEADERS{}} {BODY{}}
PROXY
is a container key that is a list of proxy configuration options:-
username
is the user name that the connection uses to authenticate the user to the proxy server. If the proxy server is not authenticating, this field is still sent, but is ignored by the proxy server. -
password
is the password associated with the user name. If the proxy server is not authenticating, this field is still sent, but is ignored by the proxy server. -
proxyServerMachine
is the host name of the computer on which the proxy server is running. -
proxyServerPort
is the IP port on which the proxy server listens for connections.
-
DEBUG 1
shows you what is being posted, including the HTTP headers.
httpget returns a keyed list containing these keys:
-
STATUS
A keyed list indicating status. For example, {Version HTTP/1.1} {Code 200} {Desc OK}.
HEADERS
A keyed list of headers. For example, {Set-Cookie name=value} {Server NCSA/1.3}.
-
BODY
A string containing requested document data.