-
Notifications
You must be signed in to change notification settings - Fork 0
cURL & wget
Hunter edited this page Oct 8, 2021
·
3 revisions
echo '{"k":"v"}' | gzip | curl -v -i --data-binary @- -H "Content-Encoding: gzip" example.com
-
-i
顯示 response header -
-v
verbose,可觀察 request header
curl -i -v https://api.github.com/users/wmh
-
-b -c
可存取 cookie
curl -b cookie.txt -c cookie.txt http://localhost/login
-
-D
把 response header 寫入檔案
curl -D headers.txt http://localhost/
-
-d
POST
curl -d "user=user&password=pass" http://localhost/login
-
-F
form string (for file upload)
curl -F "user=user" -F "key=val" -F "file=@/tmp/file.png" http://localhost/upload
-
-u
帶入帳號/密碼
curl -i -u username https://api.github.com/users/wmh
curl -i -u username:password https://api.github.com/users/wmh
- S3 putObjct to presignedURL
curl -XPUT -H "Content-type: image/png" -T file.png {{presignedURL}}
- json body
curl --header "Content-Type: application/json" \
--request POST \
--data '{"username":"xyz","password":"xyz"}' \
http://localhost:3000/api/login
- 直接使用 header 提供的檔名存檔
wget --content-disposition