submit - submit HTML form


<submit [options] URL=$theURL [var=value ...]>

The submit function submits an HTML form, i.e. as a Web browser would. The given URL is fetched, using the HTTP POST method (or its equivalent for non-HTTP URLs). The submission will include the (optional) list of variables given, URL encoded. Multi-valued variables will have each of their values sent as a separate value, e.g. for a multi-value SELECT box on a form.

Options that may be set before the variables are:

  • URL=$theURL The URL to fetch; required. Note that if it contains a query string it will be replaced by the given variables list if the METHOD is GET or HEAD.

  • METHOD=$method The HTTP method to use (or its equivalent if a non-HTTP URL is given). The default is POST. The $method may be one of OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, MKDIR or RENAME. Note that not all web servers support all methods; most implement only GET, HEAD and POST reliably. Consult an HTTP reference, such as RFC 2068, for details on these methods. Note that for FTP URLs, only GET, PUT and DELETE are supported. For Gopher URLs, the method is irrelevant. Other protocols may not support all methods, or may map some methods to an equivalent action.

  • DATA=$data The raw data to send. This is generally required for FTP URLs with the PUT method, and in conjunction with CONTENT-TYPE is useful in specifying an alternate content for HTTP submissions. Note that content is only sent for the methods POST, PUT, DELETE and OPTIONS. Supersedes FROMFILE and the variable list, if any. Added in version 2.1.900648000 19980717.

  • FROMFILE=$file The name of the file to send as content. This is useful when sending a large file via FTP, which may not fit in memory if read separately and sent as a DATA buffer. If the $file is "-" (dash), the standard input is sent instead; this is only valid for non-CGI (command-line) scripts. The FROMFILE option was added in version 2.6.938460000 19990927.

  • TOFILE=$file The name of the file to save the content to. This is useful when receiving a large file via FTP which may not fit in memory as $ret. If the $file is "-" (dash), the content is written to the standard output of the script. Note that setting TOFILE will cause the usual output document returned via $ret to be empty, and any output-derived fields obtainable via urlinfo such as links, formatted document, etc. will be unavailable. Added in version 2.6.938460000 19990927.

  • CONTENT-TYPE=$type Specify the content-type of the data given with DATA. The default is none, or "application/x-www-form-urlencoded" if variables are given directly. Added in version 2.1.900648000 19980717.

submit returns the raw document fetched.

The following HTML form found on a web site:

  Name:   <INPUT NAME=Name>
  Colors: <INPUT TYPE=checkbox NAME=Color VALUE=red>red
          <INPUT TYPE=checkbox NAME=Color VALUE=blue>blue
          <INPUT TYPE=checkbox NAME=Color VALUE=green>green
  <INPUT TYPE=submit>

could be submitted to in Vortex as follows:

<$mycolors = "red" "green">
  <submit METHOD=POST URL=
          Name="Joe Bob"

The submit function was added Sep. 17 1996. Support for FTP was added in June 1998, and Gopher in version 2.6.938200000 19990924.

In versions prior to 3.0.949000000 20000127, or if <urlcp dnsmode sys> is set, domain name resolution may exceed the <urlcp timeout> setting (due to C lib constraints).

Any query string already present in the given URL will necessarily be stripped if the METHOD is GET and one or more variables are given.

If TOFILE is given, the normal output returned via $ret is empty, and content-derived fields such as links, formatted text, etc. obtainable with urlinfo are unavailable. This is because the (potentially large) data being received is sent directly to a file without processing.

fetch, urlinfo, urlcp

Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.