我有这样的GET请求
GET /index.php?id=3000 HTTP/1.1
Host: mywebsite.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: close
响应
{"id":"3000","login":"aaaaa","first_name":"gggggg","name":"aaaa","email":"aaaaaa@gmail.com","phone":"000000
我想将对一个文本文件的所有响应从ID 1下载到3000
我厌倦了像这样的简单bash脚本
xargs --max-args=10 -i wget http://mywebsite.com/index.php?id={} < id.txt
id.txt文件包含的ID编号为1到3000
我无法将所有响应都写入1个文件,脚本create将每个repose写入单独的文件。
答案 0 :(得分:0)
这行吗?
xargs -n 1 -i wget http://mywebsite.com/index.php?id={} -O - < id.txt > result.txt
如果您不想创建id.txt,也可以
( for n in {1..3000} ; do wget http://mywebsite.com/index.php?id=$n -O - ; done ) > result.txt