Command: httppost

Syntax

httppost <url>, <datafile> {,<file> | <dir> }

Description

Sends data to a web server across the interent and downloads (fetches) the reply into a file. This command effectively performs an HTTP POST operation.

A successful URL retrieval will set the system numeric found to 1. An error will set it to 0.

Note: If the web-server from which the download is being made has authorization checks involving the completion of a web-page, e.g. a login page, then this will not be processed like a browser. Such cases will have the effect of merely downloading the login page, instead of the requested file.

Parameters

Switches

Examples

Upload a data file myfile.xml to a web servlet. The returned data will be stored in a local file result.xml. Time out after 10 seconds wait.

httppost //remotenode/MyServlet, myfile.xml, result.xml, -tim=10, -ty='text/xml'

Do the same (without the timeout) and record the returned http header information.

string header[] ;# Not strictly necessary
httppost //remotenode/MyServlet, myfile.xml, result.xml, -ty='text/xml', -os=header

Do the same, but asynchronously, processing for the result later.

atable myatab
procedure ~myatab.myproc = {
   args id=string,status=numeric,url=string
   if (status)
      tell <'Download of ',url,'failed. Status',status>
   else {
   # Do something with the result
   }
}
httppost //remotenode/MyServlet,myfile.xml,result.xml,-ty='text/xml',-os=~myatab.header,\ 
   -cb=~myatab.myproc,-id='result.xml',-to=30
#  do other stuff while waiting ...

See Also

Commands:

httpget, httpset

Identifiers

http_code (numeric), http_max_connections (numeric)