Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

post - Multiline curl command

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...