post data to a specified URL - Maple Help

URL[Post] - post data to a specified URL

 Calling Sequence Post( url, formdata, options )

Parameters

 url - a string specifying the destination URL for the content formdata - a string, list or an Array of data type integer[1] specifying the data to be sent

Description

 • The Post method sends the data specified in formdata to the url specified in url.
 • Post currently supports three url schemes: http, https and ftp.  Not all options to Post are valid for all URL schemes.
 • The input formdata can be a string or Array with datatype integer[1], or a list in which each element represents a form variable assignment.
 • The requestheaders option can be used to specify HTTP header values for the outgoing post data.  This can be used to set the Content-Type for the data.
 • The output option is a list of one or more of content, headers, and code.

content is the content returned by the URL.  One may also specify content=string where the string is a filename to which the data will be 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.

code refers to the http (and https) status code returned by the server.  It is not supported for urls with the ftp scheme.  It is returned as an integer.

Examples

 > $\mathrm{status},\mathrm{data},\mathrm{headers}:=\mathrm{URL}:-\mathrm{Post}\left("http://www.ssa.gov/cgi-bin/popularnames.cgi","year=1990&top=20&number=n",\mathrm{timeout}=100,\mathrm{output}=\left[\mathrm{code},\mathrm{content},\mathrm{headers}\right]\right):$
 > $\mathrm{type}\left(\mathrm{data},\mathrm{string}\right)$
 ${\mathrm{true}}$ (1)
 > ${\mathrm{data}}_{1..6}$
 > $\mathrm{type}\left(\mathrm{headers},\mathrm{table}\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{indices}\left(\mathrm{headers},\mathrm{nolist}\right)$
 ${"Content-type"}{,}{"Server"}{,}{"Transfer-encoding"}{,}{"Cache-control"}{,}{"Date"}$ (3)
 > ${\mathrm{headers}}_{"Content-type"}$
 ${"text/html"}$ (4)

Connect to ssa.gov using proxy server http://myproxy on port 3421 with specified proxy user credentials.

 > $\mathrm{URL}:-\mathrm{Get}\left("http://www.ssa.gov/cgi-bin/popularnames.cgi","year=1990&top=20&number=n",\mathrm{proxy}="http://myproxy:3421",\mathrm{proxyuser}="graymond",\mathrm{proxypassword}="maple"\right)$