Action()
{
int flen;
long filedes;
char file[256]="d:\\ResponseBody.txt";
char result[4];
//获取响应中的文件长度
web_set_max_html_param_len("10240");
web_reg_save_param_ex(
"ParamName=ResponseBody",
// "LB=\"code\":\"\"\,",
// "RB=\"errorInfo\":",
"LB=",
"RB=",
SEARCH_FILTERS,
"Scope=All",
"RequestUrl=*/OneDetailsIsm*",
LAST);
web_custom_request("ism详情查询",
"Url=http://10.0.50.1:5050/xire-app-ism-release-2.0.0/OneDetailsIsm/QueryOne/{ism_code}",
"Method=GET",
"Referer=",
"Mode=HTTP",
"EncType=application/json",
LAST);
//很多时候返回值有中文,需要转码,转码后的值存在了msg中
lr_convert_string_encoding(lr_eval_string("{ResponseBody}"),"utf-8",NULL,"msg");
//打印返回值
lr_output_message("转换编码后msg----%s",lr_eval_string("{msg}"));
//lr_output_message(lr_eval_string("{ResponseBody}"));
flen=strlen(lr_eval_string("{ResponseBody}"));
lr_output_message("%d",flen);
if(flen > 0)
{
//以写方式打开文件
if ((filedes = fopen(file, "a+")) == NULL)
{
lr_output_message ("Unable to create %s");
return -1;
}
//写入文件内容
// fwrite(lr_eval_string("{ResponseBody}"),flen,1, filedes);
fprintf(filedes,"%s\n",lr_eval_string("{ResponseBody}"));
//关闭文件
fclose(filedes);
}
// if((filedes = fopen("d:\\ResponseBody.txt", "rt")) == NULL)
// {
// lr_output_message("oh,cloud your Open File Failed!");
// return -1;
// }
//读文件内容
// fread( result,4,1,filedes);
// fclose( filedes );
// lr_output_message(result);
// return 0;
//return 0;
}