HTTP/Form - Help

HTTP

 Form
 Send form data to a URL

 Calling Sequence Form(URI, formdata)

Parameters

 URI - host, port, and URL path of the form http://host:port/path/to/file; the uniform resource identifier formdata - content of the form given as a list of string=string values.

Options

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

 • method= a string

either "GET" or "POST". Specify whether to submit form data as a get or post request. The default is POST.

 • timeout=posint

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

 • 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.

Description

 • Form is a higher level command that accepts the form data as a list of equations, and then properly formats it as an HTTP request.

Examples

 > $\mathrm{status},\mathrm{data},\mathrm{headers}≔\mathrm{HTTP}:-\mathrm{Form}\left("http://www.ssa.gov/cgi-bin/popularnames.cgi",\left["year"=1990,"top"=20,"number"="n"\right]\right):$
 > $\mathrm{HTTP}:-\mathrm{Code}\left(\mathrm{status}\right)$
 ${"OK"}$ (1)
 > $\mathrm{type}\left(\mathrm{data},'\mathrm{string}'\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{data}\left[1..39\right]$
 ${" Popular Baby Names<"}$ (3)
 > $\mathrm{type}\left(\mathrm{headers},'\mathrm{table}'\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{headers}\left["Content-Type"\right]$
 ${"text/html; charset=UTF-8"}$ (5)
 > $\mathrm{status},\mathrm{data},\mathrm{headers}≔\mathrm{HTTP}:-\mathrm{Form}\left("http://www.wunderground.com//history/airport/CYKF/2010/05/13/DailyHistory.html",\left[\mathrm{HideSpecis}=0,\mathrm{format}=0\right],\mathrm{method}="GET"\right):$
 > $\mathrm{HTTP}:-\mathrm{Code}\left(\mathrm{status}\right)$
 ${"OK"}$ (6)
 > $\mathrm{type}\left(\mathrm{data},'\mathrm{string}'\right)$
 ${\mathrm{true}}$ (7)
 > $\mathrm{data}\left[1..160\right]$
 ${"TimeEDT,TemperatureC,Dew PointC,Humidity,Sea Level PressurehPa,VisibilityKm,Wind Direction,Wind SpeedKm/h,Gust SpeedKm/h,Precipitationmm,Events,Conditions,Wind"}$ (8)
 > $\mathrm{type}\left(\mathrm{headers},'\mathrm{table}'\right)$
 ${\mathrm{true}}$ (9)
 > $\mathrm{headers}\left["Connection"\right]$
 ${"close"}$ (10)
 > $\mathrm{status},\mathrm{data},\mathrm{headers}≔\mathrm{HTTP}:-\mathrm{Form}\left("http://chart.apis.google.com/chart",\left[\mathrm{chs}="100x100",\mathrm{cht}="qr",\mathrm{chl}="http://mapleprimes.com/"\right]\right):$
 > $\mathrm{HTTP}:-\mathrm{Code}\left(\mathrm{status}\right)$
 ${"OK"}$ (11)
 > $\mathrm{type}\left(\mathrm{data},'\mathrm{rtable}'\right)$
 ${\mathrm{true}}$ (12)
 > $\mathrm{data}$
  (13)

Compatibility

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