maintell/webBenchmark

请教各位剑皇大佬,webBenchmark怎么设置post ?我试都不行

mengdacheng opened this issue · 3 comments

`webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p {"www":1,"qq":"2ss"}
webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p '{"www":1,"qq":"2ss"}'
webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p "{"www":1,"qq":"2ss"}"

webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p www=123&q=321
webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p 'www=123&q=321'
webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p "www=123&q=321"
webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p "start":{"100"}, "hobby":{"xxxx"}

webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p 'www=123'
webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p "www=123"
webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p www=123`

以上-p参数的值都设置不成功,请问高手能告诉我怎么设置post的参数吗?

webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p 'www=123&q=321'
webBenchmark_x64.exe -c 5 -s http://127.0.0.2/post.php -p '{"start":{"100"}, "hobby":{"xxxx"}'
请注意你的参数的写法, 不管是shell还是command prompt

大佬,我试过了,真的post不了数据,总裁喊话等我给他颜色看看呢。

不信你用下面的php代码接收一下,数据都到input里了,可能是需要你设置header才能算发送post数据吧

`
$content = date('Y-m-d H:i:s')."\n============ GET ============\n".print_r($_GET,true)."\n============ POST ============\n".print_r($_POST,true)."\n============ input ============\n\n".file_get_contents('php://input')."\n\n";
$myfile = fopen("post.txt", "a+") or die("Unable to open file!");
fwrite($myfile, $content);
fclose($myfile);

`

req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
可能缺少类似的设置

建议再给加个自定义cookie的参数把,不然对验证cookie的压测无效
req.Header.Set("Cookie", "name=anny")

post是真的可以
另外已经加上了自定义header, 并且可以随机