curl用法来获取头 [英] curl usage to get header
本文介绍了curl用法来获取头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么不起作用:
curl -X HEAD http://www.google.com
但这两个都很好:
curl -I http://www.google.com
curl -X GET http://www.google.com
解决方案您需要在第一个命令中添加-i标志,才能在输出中包含HTTP标头。这是打印标题所必需的。
curl -X HEAD -i http://www.google.com
更多此处: http://serverfault.com/questions/140149/difference-between-curl-i-and-curl-x -head
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 -X GET http://www.google.com
解决方案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: http://serverfault.com/questions/140149/difference-between-curl-i-and-curl-x-head
这篇关于curl用法来获取头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文