|
postHttp
|
The postHttp function utilizes the internal function requestHttp.
Please refer to the description for requestHttp for more detailed information
on the postHttp operation. When postHttp is invoked, AIS acts like a browser. It sends requests to an
internet server on the web, called a host, and receives back a page from the host.
Use postHttp to respond to a form where the host expects a POST request from
the browser. It is up to user of this function to specify the correct names and fields
expected by the host. For example, when first contacting a site, a logon form may be
returned by the host when a getHttp requests the default page. To be specific,
suppose that the following page is returned in response to a getHttp request:
Please enter your username and password and then select submit: The body of the POST request that is sent back from the server is a URL-encoded
query string of the form: name=jsmith&password=secret The postHttp request to emulate the request that would be generated by the
browser when the submit button is selected might be: (postHttp "http://downloadnow/download.phtml" "name|jsmith|password|secret") where | stands for a DEL character whose ascii code is 127. Note that the POST body is passed as a DEL-delimited string that is automatically
converted into a URL-encoded string by postHttp. The second argument, that specifies the body of the post, may also be passed as a
structure. In this case, the above example might also be: (postHttp "http://downloadnow/download.phtml" #{name: "jsmith" password: "secret"}) When to use Use the postHttp function to automate the collection of information from
the internet. Use getHttp to fetch pages and use postHttp to submit a
POST request after a form is received from the host. It is up to the programmer to
include the precise set of fields expected by the host in the body argument. Unlike readHtmlPage, connections are automatically maintained, and responses
can be saved in a file. Further, readHtmlPage cannot submit a POST request.
InvestByLambda
(postHttp url body filename msecToWait) Returns the entire contents of the specified HTML page including all tags.
If the timeout expires or if an error is detected, an error message is returned.
Here are a number of links to Lambda coding examples which contain this instruction in various use cases.
Here are the links to the data types of the function arguments. Here are also a number of links to functions having arguments with any of these data types.
You can always talk with the AIS at aiserver.sourceforge.net.
Name
Description
AIS Types url Any complete or partial URL as described above. Required. Symbol body A DEL-delimited string or a structure containing name-value pairs that
is converted to a URL-encoded body of a POST request. . Structure String filename If provided, the returned web page is saved in the specified file on the client
machine. The file is saved in a path relative to the current working directory.
Optional argument. Text String msecToWait If provided, it sets the maximum time to wait for a page to be returned from
the host. If no response occurs in the allotted time, an error message is returned.
The default value for this parameter is about 2000 msecs. Integer
Returns:
Examples
Argument Types
Integer
String
Text
Structure
How do I contact the AIS team?