I am trying to modify a curl request that was captured with Google Chrome Dev Tools.
Here is what the command looks like
curl "http://WEBSITE" -H "Host: WEBSITE" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" --compressed -H "Content-Type: multipart/form-data; boundary=---------------------------1184875127259" --data-binary "-----------------------------1184875127259"^ "Content-Disposition: form-data; name=""FORM1"""^ "FORM1DATA"^ "-----------------------------1184875127259"^ "Content-Disposition: form-data; name=""FORM2"""^ "FORM2DATA"^ "-----------------------------1184875127259"^ "Content-Disposition: form-data; name=""FORM3"""^ "FORM3DATA"^ "-----------------------------1184875127259"^ "Content-Disposition: form-data; name=""embed"""^ "true"^ "---------------------------1184875127259--"^ ""
Form#
is the name of the form and Form#Data
is the data I submitted in the forms.
How would I make this be a single line curl request I can just copy into my command line and have it do the same thing that my browser did?
To specify the transfer rate using curl command in Linux The curl option also provides the option to limit the data transfer rate. The values can be described in bytes, kilobytes, megabytes or gigabytes having the suffix k,m, or g respectively. '–limit-rate' option is used to specify the transfer rate.
Another tool is the curl command that you can use to make HTTP requests in the Terminal. When verbose mode is enabled with the -v flag, curl will give out more information on the HTTP request and response: $ curl -v "http://localhost:8080/student/Jane"* Trying ::1...
For Linux and MacOS: Use the \
escape character:
curl "http://WEBSITE" -H "Host: WEBSITE" \ -H "Accept: text/html,application/xhtml+xml \ ,application/xml;q=0.9,*/*;q=0.8"
For Windows: Use the ^
escape character:
curl "http://WEBSITE" -H "Host: WEBSITE" ^ -H "Accept: text/html,application/xhtml+xml ^ ,application/xml;q=0.9,*/*;q=0.8"
NOTE: watch out for the tendency to indent on multiple line commands, as it will embed spaces and screw up the curl command. the sed command replaces embedded spaces within the variables with the %20 string so that spaces can be used embedded in the strings you pass as variables
messageout="The rain in Spain stays mainly in the plains" summaryout="This is a test record" alertnameout="Test Alert" curl -v -silent request POST "URL.com?\ summary=`echo $summaryout | sed -e 's/ /%20/g'`&\ alertname=`echo $alertnameout | sed -e 's/ /%20/g'`&\ message=`echo $messageout | sed -e 's/ /%20/g'`"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With