curl 命令如何获取 http 请求的响应消息头信息?
主要有两种方式:
(1) 通过 –head 选项只返回消息头,等价于 -I,示例如下:
[demo@Linux ~]$ curl --head https://www.phpernote.com/
curl –head www.phpernote.com
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 03 Nov 2021 07:18:26 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://www.phpernote.com/
(2) 通过 -i 选项返回包含 header 内容的所有网页实体 body 信息,示例如下:
[demo@Linux ~]$ curl -i https://www.phpernote.com/
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 03 Nov 2021 07:22:15 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://www.phpernote.com/
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
—-想了解更多的linux相关异常处理怎么解决关注<计算机技术网(www.ctvol.com)!!>
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/linuxsystemusage/1001153.html