Curl Command to Repeat URL Request

2019-03-08 13:56发布

Whats the syntax for a linux command that hits a URL repeatedly, x number of times. I don't need to do anything with the data, I just need to replicate hitting refresh 20 times in a browser.

标签: linux url curl
3条回答
唯我独甜
2楼-- · 2019-03-08 13:57

You could use URL sequence substitution with a dummy query string (if you want to use CURL and save a few keystrokes):

curl http://www.myurl.com/?[1-20]

If you have other query strings in your URL, assign the sequence to a throwaway variable:

curl http://www.myurl.com/?myVar=111&fakeVar=[1-20]

Check out the URL section on the man page: https://curl.haxx.se/docs/manpage.html

查看更多
ゆ 、 Hurt°
3楼-- · 2019-03-08 14:09

You might be interested in Apache Bench tool which is basically used to do simple load testing.

example :

ab -n 500 -c 20 http://www.example.com/

n = total number of request, c = number of concurrent request

查看更多
迷人小祖宗
4楼-- · 2019-03-08 14:23
for i in `seq 1 20`; do curl http://url; done

Or if you want to get timing information back, use ab:

ab -n 20 http://url/
查看更多
登录 后发表回答