Loadrunder Script--web_submit_data Implementation submit POST request

Source: Internet
Author: User

Overview

The Web_link () and Web_url () functions are page-accessible functions that implement the Get method in HTTP requests, and use the Web_submit_form or Web_submit_data () function if you need to implement the Post method. When the request is special, Vugen cannot use the above 4 functions, the Web_custom_request () function is used.

Among them, web_submit_form similar to the Web_submit_data function, the difference is that the Web_submit_data () function does not need to refer to the page support, directly sent to the corresponding page related data.

function prototype (C)

int web_submit_data (const char *stepname, const char *action, ItemData,, [Extrares,,] last);

stepname: Custom Function name

Action: The HTTP address to be accessed when submitting data. Syntax: "action="

List of Attributes: supports the following properties

Method: Form submission methods: Post or GET (default: Post).

EncType: Encoding used by the method

The Enctype property indicates the value of the Content-type request header, as follows:

    • "Enctype=application/x–www–form–urlencoded"
    • "Enctype=multipart/form–data"
    • "Enctype=" (an empty string indicating that the request does not contain a "Content–type" request header).

If "EncType" is specified, it overrides the Content-type specified by the Web_add_[auto_]header function. If "EncType" is omitted, then the Web_add_[auto_]header function is specified. If neither enctype nor the Web_add_[auto_]header function is used to set the request header, and "Method=post", then "application/x-www-form-urlencoded" will be used as the default value. If the method is not a post, then the Content-type request header will not be generated.

encodeatsign: The encoded "@" symbol is its ASCII representation. The optional value is Yes or No.

targetframe: Frame containing the current link, resource

Referer: URL of the referenced Web page

Mode: Recording level: HTML or HTTP. Click here for more information.

useragent: Identifies a component instead of a browser to execute functions, such as the browser's ActiveX component. The UserAgent function adds a header to the request. Do not check whether the useragent matches the browser user-agent run-time settings for any confirmation.

ItemData: Separating the attribute list and the identity of the data list

listof data: Defines the forms. The data field contains all the forms that are hidden (carrying the hidden attribute).

Data fields.

The value of the data field can be encrypted (encrypted) or original (plain), as follows:

"Name=n1", "Value=v1", Enditem,

"Name=n2", "Encryptedvalue=qwerty", Enditem,

extrares: Indicates that the next parameter is a list of resource properties.

List of Resource Attributes: Resource Property lists

When recorded in step in the current script, additional resources are listed as parameters and support the following resource properties:

Web resources that the URL needs to load

Referer URL-referenced web page

Enditem represents the tag at the end of each resource in the list

Non-HTML resources, such as. gif and. jpg images, are inserted into the current function only when the resource recording option is set to record within, as follows:

last implies the end of the attribute list.

The action function performs a "unconditional" or "contextless" form submission. Allows the sending of Get and post HTML form requests.

This function is generated when you choose to record a Web session in HTTP recording mode. In addition, this function is also generated when a web_submit_form cannot be generated when the form is submitted.

Example 1: Uploading a file

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);

Operation Result:



Compare tool test results:



Example 2: Landing

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);

Loadrunder Script--web_submit_data Implementation submit POST request

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.