Web Scrapers Generator BrowserExt


Submits the form, loads the answer and executes the operators and functions, defined in the submitform body.

[@multi] submitform(form, [encoding = 'UTF-8', [headers = array()]]) {
    //submitform body


form Dictionary with the form parameters returned by the function getfrom.
encoding Original encoding of the page on the server. Required to pass the correct parameters in the post request.
headers HTTP headers sent by the page loads. Array of strings. Through this option you can, for example, send cookie.

Submitform body is implemented the same way is the loadpage in the cycle if there are links in the downloading queue. Links can be added to download queue by means of function continue

Pageparams dictionary with loaded page parameters is available inside:

pageparams['page'] The string containing page's html code
pageparams['url'] Loaded page url. If the page was loaded by get method, url will contain parameters too.
pageparams['effectiveurl'] The final url of the loaded page. Final url is different from the given url for, as an example, redirect of the page has been done. If you launch the script from the Editor this parameter won't be supported.
pageparams['domain'] Loaded page domain. For example, for the loaded page http://site.com/123.html domain will be http://site.com/
pageparams['encoding'] Original page encoding at the server. Page, loaded from the loadpage will always be encoded to UTF-8
pageparams['headers'] Passed when page was loaded headers string. If launch with the Script Editor the parameter is not supported.

submitform body, like a loadpage has a local scope, that's why variables, defined inside the loadpage, can be seen only inside this body and can't be seen outside so as at the body of nested loadpage or submitform.

All of the functions, valid inside the loadpage are working inside the submtform too.

Example 1.

It is possible to pass a parameter to the loadpage body, to do this you must specify a value or a variable in square brackets after the parameters list. The value of this parameter will be available in the loadpage body as the value of variable with name passparams. Also, a parameter can be passed through the second parameter of the function continue. See example in the description of the function loadpage.