Linux 上用 curl 查看請求頭和響應頭
curl,全稱 CommandLine URL 或 CommandLine Uniform Resource Locator,顧名思義,curl 命令是在命令行方式下工作,利用 URL 的語法進行數據的傳輸或者文件的傳輸。
curl 是基於 URL 語法在命令行方式下工作的文件傳輸工具,它支持 FTP,FTPS,HTTP,HTTPS,GOPHER,TELNET,DICT,FILE 及 LDAP 等協議。curl 支持 HTTPS 認證,並且支持 HTTP 的 POST,PUT 等方法,FTP 上傳,kerberos 認證,HTTP 上傳,代理服務器,cookies,用戶名 / 密碼認證,通過 http 代理服務器上傳文件到 FTP 服務器等等,功能十分強大。
# curl --help
# curl https://www.baidu.com
返回 response body
**# curl -v https://www.baidu.com
**
返回 request header request body response header response body
# curl -i https://www.baidu.com
返回 response header 和 response body
# curl -I www.baidu.com
返回 response header
curl -s -D - https://www.baidu.com -o /dev/null
測試網頁返回值,在腳本中,這是很常見的測試網站是否正常的用法。
# curl -o /dev/null -s -w %{http_code} www.linux.com
# wget --help
wget https://www.baidu.com --debug
# wget www.baidu.com -S
Linux curl 命令詳解
https://www.cnblogs.com/duhuo/p/5695256.html
https://codeday.me/bug/20170221/3829.html
TCP/UDP 常見端口參考
http://tools.jb51.net/table/tcp_udp_port
HTTP 響應頭和請求頭信息對照表
http://tools.jb51.net/table/http_header
HTTP 狀態碼對照表
http://tools.jb51.net/table/http_status_code
HTTP Content-type 對照表
http://tools.jb51.net/table/http_content_type
本文由 Readfog 進行 AMP 轉碼,版權歸原作者所有。
來源:https://www.jianshu.com/p/3f8fbacf753c