tags:

views:

2799

answers:

2

I want to get the headers only from a curl request

curl -I www.google.com

All grand. Now I want to do that but to pass in post data too:

curl -I -d'test=test' www.google.com

But all I get is:

Warning: You can only select one HTTP request!

Anyone have any idea how to do this or am I doing something stupid?

+2  A: 

-d means you are sending form data, via the POST method. -I means you are just peeking at the metadata via HEAD.

I'd suggest either

  • Download to /dev/null and write the headers via the -D headerfile to the file headerfile
  • Use -i to include the headers in the answers and skip everything from the first empty line.
phihag
Cheers, makes sense
J.D. Fitz.Gerald
Old, I know, but I would suggest adding `-s` to clean up the output a little bit.
Bryan Ross
+4  A: 

curl -s -d'test=test' -D- www.google.com -o/dev/null

That is the neatest way to do this as far as I can find.

J.D. Fitz.Gerald