擷取http請求頭資訊,-I 隻列印response header, -i 列印response header和body
curl -I "http://www.jouypub.com"
curl -i "http://www.jouypub.com"
使用代理
curl -x 1.193.162.91:8000 http://www.jouypub.com
curl -x 1.193.162.91:8000 --connect-timeout 3 --max-time 10 http://www.jouypub.com
上傳檔案
curl -F "filename=@/home/test/file.tar.gz" http://localhost/action.php
-F參數,curl就會以 multipart/form-data 的方式發送POST請求。-F參數以name=value的方式來指定參數内容,如果值是一個檔案,則需要以name=@file的方式來指定。
選項
-d 以post方式請求
-H 請求時添加header,冒号前後不能有空格
curl -H "name=abc" http://www.jouypub.com
-o 結果輸出到指定檔案
curl -o /dev/null http://www.jouypub.com
-m/--max-time 指定最大允許時間,機關秒
curl -m 20 http://www.jouypub.com
--connect-timeout 連接配接逾時,機關秒
curl --connect-timeout 5 http://www.jouypub.com