|
下面是我录制http://www.fjgsgl.com/费率查询过程的代码:(只贴出了action部分)- Action()
- {
- char leon[512];
- int leon1;
- int m,n;
- /* lr_think_time(32);*/
- leon1=(int)fopen("D:\\huoyanming.txt","at+");
- for(m=0;m<3;m++)
- {
- lr_save_string( lr_eval_string( "{zhan1} "), "tmp ");
- for(n=0;n<3;n++)
- {
- web_reg_save_param("leon","LB=距离为","RB=公里",LAST);
- lr_message("value:%s",lr_eval_string("{leon}"));
- web_submit_data("zfbz.asp",
- "Action=http://www.fjgsgl.com/zfbz.asp?zf=submit",
- "Method=POST",
- "RecContentType=text/html",
- "Referer=http://www.fjgsgl.com/zfbz.asp",
- "Snapshot=t2.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=names1", "Value={tmp}", ENDITEM,
- "Name=names2", "Value={zhan2}", ENDITEM,
- "Name=B1", "Value=查询", ENDITEM,
- LAST);
-
- fprintf(leon1, "从%s到%s距离为%s公里\n ",lr_eval_string("{zhan1}"),lr_eval_string("{zhan2}"),lr_eval_string("{leon}"));
- }
- }
- fclose(leon1);
- return 0;
- }
复制代码 费率查询动作是要提交一个表单,该表单有两个选项(出发地和目的地),我想查询每两个站点之间的距离,因此我在代码中用到了2层循环,在外层循环中加入了参数zhan1,它是file类型,内层循环也有一个参数zhan2,它也是file类型,运行后写到结果文件中的内容却是“从2101到2301距离为N/A公里”,“从2101到2302距离为N/A公里”……我试过,该网站上进行费率查询时只有当两个选项至少一个没选时才应该为"N/A",也就是说现在我的代码中导致表单的两个选项中有的没选。
我还试过只把第二个选项参数化,即:- Action()
- {
- char leon[512];
- int leon1;
- int m,n;
- /* lr_think_time(32);*/
- leon1=(int)fopen("D:\\huoyanming.txt","at+");
- for(n=0;n<3;n++)
- {
- web_reg_save_param("leon","LB=距离为","RB=公里",LAST);
- lr_message("value:%s",lr_eval_string("{leon}"));
- web_submit_data("zfbz.asp",
- "Action=http://www.fjgsgl.com/zfbz.asp?zf=submit",
- "Method=POST",
- "RecContentType=text/html",
- "Referer=http://www.fjgsgl.com/zfbz.asp",
- "Snapshot=t2.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=names1", "Value=2101", ENDITEM,
- "Name=names2", "Value={zhan2}", ENDITEM,
- "Name=B1", "Value=查询", ENDITEM,
- LAST);
-
- fprintf(leon1, "从2101到%s距离为%s公里\n ",lr_eval_string("{zhan2}"),lr_eval_string("{leon}"));
- }
- fclose(leon1);
- return 0;
- }
复制代码 这时就可以正确显示结果,请各位帮忙看看进行两个参数化(2层循环)时应该怎么做呢?问题出在哪里呢? |
|