Example: web_reg_save_param_ex
This example shows the use of web_reg_save_param_ex to save all of the strings between LL
and RR
in the body of a response.
Action() { char arrayParamName[50]; int elemCnt; int x; lr_save_string( "HTTP%2F1%2E1%20301%20Moved%20Permanently%0A%0D" "Content%2DType%3A%20text%2Fhtml%0A%0D" "Date%3A%20Sun%2C%2014%20Feb%202010%2011%3A15%3A34%20GMT%0A%0D" "%0A%0D" "aaLLb%20bLLc%20%2E%2ecRRddRReeRRffLLggsadfsdfsdfRRhhRRiiLLj%20%2d%2DjRRkkLLmmLLnnRRoooRRpppLLqqq%0A%0D", "inParam" ); web_reg_save_param_ex( "ParamName=newParam", "LB/IC=ll", "RB/IC=RR", "Ordinal=all", "SaveLen=-1", "DFEs=UrlEncoding", SEARCH_FILTERS, "Scope=body", LAST); web_submit_data("echo.asp_2", "Action=http://localhost/cgi-bin/echo.asp", "Method=POST", "TargetFrame=", "RecContentType=text/html", "Referer=http://localhost/cgi_examples/echo_asp.html", "Snapshot=t4.inf", "Mode=HTML", ITEMDATA, "Name=code", "Value={inParam}", ENDITEM, LAST);
/* Getting individual elements from a parameter array. Since the parameter created by web_reg_save_param_ex is called "newParam", the number of elements is saved in parameter "newParam_count". The array elements are parameters "newParam_1", "newParam_2", ... "newParam_n". */
elemCnt = atoi(lr_eval_string("{newParam_count}")); lr_output_message("Number of items found = %d",elemCnt);
for (x=1;x<=elemCnt;x++) { sprintf(arrayParamName, "{newParam_%d}", x); lr_output_message ("%s: %s",
arrayParamName,
lr_eval_string(arrayParamName)); } return 0; }
Action.c(45): {newParam_1}: c ..c
Action.c(45): {newParam_2}: ggsadfsdfsdf
Action.c(45): {newParam_3}: j --j
Action.c(45): {newParam_4}: nn