Example: web.submit_form

In the following example, web.submit_form logs in to the MercuryWebTours sample application.

try
{
web.url("MercuryWebTours",
    "URL=http://localhost/MercuryWebTours/",
    new String[]{
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t1.inf",
        "Mode=HTML",
        web.LAST
    });

web.url("home.html",
    "URL=http://localhost/MercuryWebTours/home.html",
    new String[]{
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://localhost/MercuryWebTours/welcome.pl?signOff=true",
        "Snapshot=t2.inf",
        "Mode=HTML",
        web.LAST
    });

web.url("nav.pl",
    "URL=http://localhost/MercuryWebTours/nav.pl?in=home",
    new String[]{
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://localhost/MercuryWebTours/welcome.pl?signOff=true",
        "Snapshot=t3.inf",
        "Mode=HTML",
        web.LAST
    });    
/* Notes on web.submit_form:
The options[] array must be present even if there are no options. Pass an empty new String function block as shown below.
The "data[]" string does not have a leading "ITEMDATA" delimiter as it would in the C language syntax.
Though the delimiters ENDITEM and LAST are lrapi.web constants, EXTRARES is not. EXTRARES is passed as a quoted string.*/
//submit_form(String stepName, String options[], String data[]) 
web.submit_form("login.pl", // stepName
    new String[]{}, // options[]
    new String[]{ //data[]
        "Name=username", "Value=jojo", web.ENDITEM,
        "Name=password", "Value=bean", web.ENDITEM,
        "Name=signup.x", "Value=59", web.ENDITEM,
        "Name=signup.y", "Value=13", web.ENDITEM,
        "EXTRARES",
        "Url=images/flights.gif",
    "Referer=http://localhost/MercuryWebTours/nav.pl?page=menu&in=home", 
        web.ENDITEM,
        web.LAST
    });