curl usage to get header

后端 未结 3 1088
无人共我
无人共我 2021-01-30 20:12

Why does this not work:

curl -X HEAD http://www.google.com

But these both work just fine:

curl -I http://www.google.com

curl -         


        
3条回答
  •  有刺的猬
    2021-01-30 20:47

    You need to add the -i flag to the first command, to include the HTTP header in the output. This is required to print headers.

    curl -X HEAD -i http://www.google.com
    

    More here: https://serverfault.com/questions/140149/difference-between-curl-i-and-curl-x-head

提交回复
热议问题