新手,帮忙看一段代码
我是想实现这样一个功能:在下面这个网站上:http://www.fjgsgl.com/,我想在它主页右侧的费率查询栏目中查询所有两两站点之间的距离(数据量大概有5000条左右),并把结果输出到一个文件中,一位朋友帮我写了段代码,如下:Action(){
int m,n;
char leon;
int leon1;
web_url( "www.fjgsgl.com ",
"URL=http://www.fjgsgl.com/ ",
"TargetFrame= ",
"Resource=0 ",
"RecContentType=text/html ",
"Referer= ",
"Snapshot=t1.inf ",
"Mode=HTML ",
EXTRARES,
"URL=/focus.swf ",ENDITEM,
"URL=/main.files/105x75.jpg ",ENDITEM,
"URL=/main.files/fqgs002.gif ",ENDITEM,
"URL=/main.files/fqgs001.jpg ",ENDITEM,
"URL=/Foosun_Plus/Ads/CreateJs/RightBottom.js ",ENDITEM,
LAST);
web_custom_request("urs.asmx ",
"URL=https://urs.microsoft.com/urs.asmx?MSPRU-Client-Key=S4uXVHsMw2lMYlhTRRlyXA%3d%3d&MSPRU-Patented-Lock=ts5iAr%2b/rnw%3d ",
"Method=POST ",
"TargetFrame= ",
"Resource=0 ",
"RecContentType=text/xml ",
"Referer= ",
"Snapshot=t2.inf ",
"Mode=HTML ",
"EncType=text/xml;charset=utf-8 ",
"Body= <soap:Envelope xmlns:soap=\ "http://schemas.xmlsoap.org/soap/envelope/\ " xmlns:xsi=\ "http://www.w3.org/2001/XMLSchema-instance\ " xmlns:xsd=\ "http://www.w3.org/2001/XMLSchema\ " xmlns:soapenc=\ "http://schemas.xmlsoap.org/soap/encoding/\ "> <soap:Body> <Lookup xmlns=\ "http://Microsoft.STS.STSWeb/\ "> <r soapenc:arrayType=\ "xsd:string\ "> <string> http://www.fjgsgl.com </string> </r> <ID> {A0AB7674-8D67-4F4D-B5E1-96FAEADFB79D} </ID> <v soapenc:arrayType=\ "xsd:string\ "> <string> 7.0.6004.6 </string> <string> 7.00.6000.16730 </string> <string> 7.0.5730.13 </string> <string> 5.1.2600.2.0 </string> <string> zh-cn </string> </v> </Lookup> </soap:Body> </soap:Envelope> ",
LAST);
web_custom_request("urs.asmx_2 ",
"URL=https://urs.microsoft.com/urs.asmx?MSPRU-Client-Key=uOt2PA6dKVA1gk9vIGgXLg%3d%3d&MSPRU-Patented-Lock=OaIDEoRE/yI%3d ",
"Method=POST ",
"TargetFrame= ",
"Resource=0 ",
"RecContentType=text/xml ",
"Referer= ",
"Snapshot=t3.inf ",
"Mode=HTML ",
"EncType=text/xml;charset=utf-8 ",
"Body= <soap:Envelope xmlns:soap=\ "http://schemas.xmlsoap.org/soap/envelope/\ " xmlns:xsi=\ "http://www.w3.org/2001/XMLSchema-instance\ " xmlns:xsd=\ "http://www.w3.org/2001/XMLSchema\ " xmlns:soapenc=\ "http://schemas.xmlsoap.org/soap/encoding/\ "> <soap:Body> <Lookup xmlns=\ "http://Microsoft.STS.STSWeb/\ "> <r soapenc:arrayType=\ "xsd:string\ "> <string> http://www.fjgsgg.com/zfbz.asp </string> </r> <ID> {A0AB7674-8D67-4F4D-B5E1-96FAEADFB79D} </ID> <v soapenc:arrayType=\ "xsd:string\ "> <string> 7.0.6004.6 </string> <string> 7.00.6000.16730 </string> <string> 7.0.5730.13 </string> <string> 5.1.2600.2.0 </string> <string> zh-cn </string> </v> </Lookup> </soap:Body> </soap:Envelope> ",
EXTRARES,
"URL=http://www.fjgsgl.com/files/2009/60.jpg ","Referer=http://www.fjgsgl.com/focus.swf ",ENDITEM,
"URL=http://www.fjgsgl.com/Files/2009/DSC00600.JPG ","Referer=http://www.fjgsgl.com/focus.swf ",ENDITEM,
"URL=http://www.fjgsgl.com/Files/W020080103316475157468.jpg ","Referer=http://www.fjgsgl.com/focus.swf ",ENDITEM,
"URL=http://www.fjgsgl.com/Files/kxfzg090328.jpg ","Referer=http://www.fjgsgl.com/focus.swf ",ENDITEM,
"URL=http://www.fjgsgl.com/Files/slogan1024.jpg ","Referer=http://www.fjgsgl.com/focus.swf ",ENDITEM,
"URL=http://www.fjgsgl.com/main.files/lihoulin400x215.jpg ","Referer=http://www.fjgsgl.com/focus.swf ",ENDITEM,
LAST);
web_url("show.asp ",
"URL=http://www.fjgsgl.com/Foosun_Plus/Ads/show.asp?Location=5 ",
"TargetFrame= ",
"Resource=0 ",
"RecContentType=text/html ",
"Referer=http://www.fjgsgl.com/ ",
"Mode=HTML ",
LAST);
/*页面显示完毕
*/
lr_think_time(48);
for(m=1;m <=10;m++)
{
lr_save_string( lr_eval_string( "{name1} "), "tmp ");
for(n=1;n <=10;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.fjgsgg.com/zfbz.asp?zf=submit ",
"Method=POST",
"TargetFrame=",
"RecContentType=text/html",
"Referer=http://www.fjgsgg.com/zfbz.asp",
"Snapshot=t4.inf",
"Mode=HTML",
ITEMDATA,
"Name=names1","Value={tmp}",ENDITEM,
"Name=names2","Value={name2}",ENDITEM,
"Name=B1","Value=查询",ENDITEM,LAST);
leon1=(int)fopen("C:\\huoyanming.txt","at+");
fprintf(leon1, "从%s到%s距离为%s公里\n ",lr_eval_string("{name1}"),lr_eval_string("{name2}"),lr_eval_string("{leon}"));
fclose();
}
}
/*查询完毕
*/
return 0;
}我运行的时候提示如下错误:
vuser_init.c (33): warning: unrecognized character escape sequence `\ '
vuser_init.c (33): syntax error; found `http' expecting `)'
vuser_init.c (33): syntax error; found `http' expecting `;'
vuser_init.c (34): syntax error; found `)' expecting `;'
vuser_init.c (34): illegal statement termination
vuser_init.c (34): skipping `)'
vuser_init.c (46): warning: unrecognized character escape sequence `\ '
vuser_init.c (46): syntax error; found `http' expecting `)'
vuser_init.c (46): syntax error; found `http' expecting `;'
vuser_init.c (46): redefinition of label `http' previously defined at vuser_init.c (33)
vuser_init.c (54): syntax error; found `)' expecting `;'
vuser_init.c (54): illegal statement termination
vuser_init.c (54): skipping `)'
Action.c (2): redefinition of `Action' previously defined at vuser_init.c (1)
c:\\documents and settings\\liupeng\\local settings\\temp\\noname4\\\\combined_noname4.c (5): 12 errors, not writing pre_cci.ci
之前没有接触过LoadRunner,完全看不懂啊,请各位朋友帮帮忙,感谢! 没看明白帮你顶了 。。。不是有出错提示的么。。。
从第一个开始检查。。。后面的错误有可能是第一个引起的。。。
我稍微看了下斜杠可能是引号转义之类的问题 你双击错误处,会自动定位到你脚本相应部分,都是语法问题。
页:
[1]