我在做 b/s 測試 ,請問如何保存從 服務器 傳回來的 http 頭的信息,怎么能得到 http 狀態,和狀態 200 進行比較? 后來,我" name="description" />
后來,我給出的代碼如下:
Action()
{int i;
// [WCSPARAM WCSParam_Text1 3 200] Parameter {WCSParam_Text1} created by Correlation Studio
web_reg_save_param("WCSParam_Text1",
"LB=1.1 ",
"RB= ",
"Ord=1",
"RelFrameId=1",
"Search=Headers",
"IgnoreRedirections=Yes",
LAST);
web_url("www.hao123.com",
"URL=http://www.hao123.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
i=atoi(lr_eval_string("{WCSParam_Text1}"));
if (i == 200)
lr_log_message("終于成功了??!我不容易呀?。?!");
else
lr_log_message("唉,又失敗了,不過這才是正常的! ");
return 0;
}
后來查了幫助,看到如下方法才好:
Action()
{
int HttpRetCode;
web_url("www.hao123.com",
"URL=http://www.hao123.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
if (HttpRetCode == 200)
lr_log_message("終于成功了??!我不容易呀?。?!");
else
lr_log_message("唉,又失敗了,不過這才是正常的! ");
return 0;
}
關于函數,偶不說了,查看幫助,清楚著哩
原文轉自:http://www.anti-gravitydesign.com