X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=curl.md;h=ac633472e71e536eedd12465fd093f6714b92f26;hb=cc0d61c87efc1ce505853395c21a9749567bed1c;hp=b04235975f555b543b536d06d4c6aeb52950b19c;hpb=6915cf69337beea7699e8b53e80d71087d43ce1c;p=twpd%2Fmaster.git diff --git a/curl.md b/curl.md index b042359..ac63347 100644 --- a/curl.md +++ b/curl.md @@ -2,7 +2,7 @@ title: Curl category: CLI layout: 2017/sheet -updated: 2017-09-20 +updated: 2020-03-09 --- ## Options @@ -17,10 +17,12 @@ updated: 2017-09-20 ```bash -v # --verbose -vv # Even more verbose --s # --silent +-s # --silent: don't show progress meter or errors +-S # --show-error: when used with --silent (-sS), show errors but no progress meter ``` ```bash +-i # --include: Include the HTTP-header in the output -I # --head: headers only ``` @@ -28,7 +30,8 @@ updated: 2017-09-20 ```bash -X POST # --request --L # follow link if page redirects +-L # follow link if page redirects +-F # --form: HTTP POST data for multipart/form-data ``` ### Data @@ -78,4 +81,13 @@ curl -u user:pass -d status="Hello" http://twitter.com/statuses/update.xml ```bash # multipart file upload curl -v -include --form key1=value1 --form upload=@localfilename URL + +# multipart form: send data from text field and upload file +curl -F person=anonymous -F secret=@file.txt http://example.com/submit.cgi +``` + +```bash +# Use Curl to Check if a remote resource is available +# details: https://matthewsetter.com/check-if-file-is-available-with-curl/ +curl -o /dev/null --silent -Iw "%{http_code}" https://example.com/my.remote.tarball.gz ```