對于喜歡使用命令行的程序員來說,curl是一個利器。它是我們用來和服務(wù)器進行數(shù)據(jù)交換的工具,支持http、https、ftp、ldap等多種常用協(xié)議。
信息輸出
采用-w參數(shù),變量指定方式為%{variable_name},常用參數(shù)如下
time_total "The total time, in seconds, that the full operation lasted
請求頭
采用-H參數(shù) ,官方解釋(Http) Extra header to include in the request when sending Http to a server。注:可以指定任意數(shù)量的請求頭。
# 列出常用demo
curl -H "Host:" #指定Hostname