'How can I successfully send multiple curl post requests using different values located in a text file for the -data header
I am trying to send a series of about a 1000 curl requests one after another to the same server using different -data header values from a text file. So one call looks like the following:
curl -H "Host: example.com" -H "Accept: */*" -H "DNT: 1" -H "Content-Type: application/json" -H "sec-ch-ua-mobile: ?0" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36" -H "sec-ch-ua-platform: "Windows"" -H "Origin: https://www.example.com" -H "Sec-Fetch-Site: cross-site" -H "Sec-Fetch-Mode: cors" -H "Sec-Fetch-Dest: empty" -H "Referer: https://www.example.com/" -H "Accept-Language: en-US,en;q=0.9" --data-binary '{"number":"1000"}' -X "https://www.example.com/numbers" | sudo tee -a sometext.txt && sleep 5
the data-binary header value I would like to be fed values from a text file one by one, the text file is unix format witha value then a new line for 1000 individual values like the following:
1000
2000
3000
the work around that I have been using is literally copying the curl request to an excel document and splitting it at the -data-binary header and then auto filling the spreadsheet 1000 times then copy and pasting the values from the text file into the new column of the spreadsheet similar to the following: excel screenshot
then I am copying all 1000 entries to notepad and saving it as an .sh file then running it from a linux terminal and outputting the results to another text file. Would anyone be able to show me examples of how to do this programmically. I am trying to learn python however I am not particular about what language is used.thank you in advance for any assistance and since this is my first post please forgive any errors with the question or the attached code. Kind Regards
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
