cURL: Tips

Options in the integration with Shell
CURL_CMD="curl"
CURL_OPT="-qSfs -m 60"
CURL_OPT_POST="-qSfs -m 60 -X POST"
POST Request

Send an Empty POST Request

curl -X POST https://catonmat.net

Send a POST Request with Form Data

curl -d 'login=emma&password=123' -X POST https://google.com/login
GET Request

Send a GET Request and Print the Response to Screen

curl https://catonmat.net/api?a=1&b=2

Send a GET Request and Save the Response to a File

curl -o response.txt https://catonmat.net/api?a=1&b=2
延伸閱讀