1

I need a script that performs a curl request within a loop. One parameter of the request must be replaced

PARAM[0]=FOO           
PARAM[1]=BAR                                                      

for i in "${PARAM[@]}"
do
   :
echo $i
curl  'http://testurl.com/test' -H 'Accept: text/plain, */*; q=0.01' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'  -H 'Host: ipq-t2.bmwgroup.net' -H 'Pragma: no-cache' -H 'Referer: http://testurl.com/test' -H 'X-Requested-With: XMLHttpRequest' --data 'param=$i' --compressed >> response.txt

done 

The problem is within the curl command, the $i apparently does not get replaced properly with the data from the array in the loop.

Any help is appreciated. Thanks!

Paul
  • 547
  • 4
  • 13
  • 30

0 Answers0