Action function -web_submit_data

web_submit_data("login.pl",

        "Action=http://127.0.0.1:1080/WebTours/login.pl",

        "Method=POST",

        "TargetFrame=body",

        "RecContentType=text/html",

        "Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",

        "Snapshot=t3.inf",

        "Mode=HTML",

        ITEMDATA,

        "Name=userSession", "Value=118025.184447145zAHAQcAptcfDztcfpfccff", ENDITEM,

        "Name=username", "Value=jojo", ENDITEM,

        "Name=password", "Value=bean", ENDITEM,

        "Name=JSFormSubmit", "Value=off", ENDITEM,

        "Name=login.x", "Value=58", ENDITEM,

        "Name=login.y", "Value=2", ENDITEM,

        LAST);
StepName: Custom Function name 

Action: http address when submitting data need to be accessed. Syntax: " the Action = "  

Method,: Form submission method: POST or the GET (default: POST). 
Enctype: encoding method used 
Enctype attribute specifies the Content - value Type request header value, as follows:
 " enctype = file application / X- -form-urlencoded WWW " 
" enctype = multipart / form-Data "   
" enctype = " (the empty string, that the request does not contain " the Content-the Type " request header). 
 
If the specified" encType ", then it will cover web_add_ [auto_] header function specified Content - Type. If omitted, the "EncType", then the use of web_add_ [auto_] header specified function. 

If neither used nor EncType web_add_ [auto_] header function setting request header, and "Method, = the POST", then, using the "application / x-www-form-urlencoded "as the default value. 

If Method is not POST, it will not be generated Content - Type request header. 

EncodeAtSign: coded " @ " . notation for optional ASCII values are Yes or No. 
TargetFrame: contains the current links, resources the Frame 
Referer: url web pages are references 
Mode: recording level:. HTML or the Click here Wallpaper HTTP for More Information. 
UserAgent:. identify a component alternative browser to perform a function, such as the browser's ActiveX component function adds for the request . UserAgent head 

does not match the UserAgent UserAgent


 browser settings to do any validation checks run. 
the ItemData: delimited list of attributes and identity and data list 
list of data: .data define the form data field contains any hidden (carry hidden attribute ) of the form data. 
data field. 
after the value of the data field may be encrypted (eNCRYPTED) or original (plain), as follows: " name = N1 " , " value = V1 ", ENDITEM,
 " name = n2 " , " EncryptedValue = QWERTY " , ENDITEM, 
EXTRARES: show the next parameter is a list of resource properties. 

 
List of Resource Attributes: resource attribute list 
when record in the current script step, additional resources are listed as parameters, supports the following resource properties: 
the URL of the web resources need to load 
Referer URL referenced web page 
ENDITEM representation in the list, each resource marks the end of the 
non-HTML resources, such as .gif and .jpg images, only the resource record time option is set to record within the current script step, it will be inserted into the current function, as follows: 

LAST imply the end of the list of attributes. 
action function, the implementation of " Unconditional " or " contextless " form is submitted. It allows sending an HTML form GET and POST requests.

Sample Code

例1:上传文件
web_submit_data("choujiang",

        "Action=http://xxx.xxx.x.xx:xxx/ditui/fileupload",

        "Method=POST",

        "Resource=0",

        "RecContentType=application/json",

        "Referer=",

        "Mode=HTML",

        "EncType=multipart/form-data",

         ITEMDATA,

         "Name=MultiPart File","Value=E://test_pic.png", "File=yes", ENDITEM,

        LAST);

 

Guess you like

Origin www.cnblogs.com/lvchengda/p/12626031.html