Difference between revisions of "CURL"
Jump to navigation
Jump to search
↑ http://man7.org/linux/man-pages/man1/curl.1.html
↑ https://docs.gitlab.com/ee/api/notification_settings.html#global-notification-settings
↑ https://stackoverflow.com/questions/3252851/how-to-display-request-headers-with-command-line-curl
Line 9: | Line 9: | ||
* <code>curl https://google.com/file_to_download -o output_file_name</code> | * <code>curl https://google.com/file_to_download -o output_file_name</code> | ||
* <code>curl -sS https://google.com</code> | * <code>curl -sS https://google.com</code> | ||
− | ::<code>-s | + | ::<code>-s --silent Avoid showing progress bar</code> |
+ | ::<code>-S --show-error</code> | ||
* <code>curl -u YOUR_USERNAME:YOUR_PASSWORD https://yourpasswordprotectedpage.com/</code> | * <code>curl -u YOUR_USERNAME:YOUR_PASSWORD https://yourpasswordprotectedpage.com/</code> | ||
* <code>curl -sSL</code> | * <code>curl -sSL</code> |
Revision as of 15:29, 11 August 2021
cURL[1] is a command-line tool for getting or sending data including files using URL syntax. cURL supports a range of common network protocols, currently including HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, LDAP, DAP, DICT, TELNET, FILE, IMAP, POP3, SMTP and RTSP.
Examples
curl --help
curl -vvv https://google.com
curl --insecure https://yourdomain.com
curl https://google.com/file_to_download -o output_file_name
curl -sS https://google.com
-s --silent Avoid showing progress bar
-S --show-error
curl -u YOUR_USERNAME:YOUR_PASSWORD https://yourpasswordprotectedpage.com/
curl -sSL
- Save your cookies and reuse them:
curl --user user:pass --cookie-jar ./somefile_with_your_cookies https://xyz.com/a
curl --cookie ./omefile_with_your_cookiese https://xyz.com/b
curl --header 'X-JFrog-Art-Api: 1234567890'
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/notification_settings
[2]
- Upload a file:
curl -u YOUR_USERNAME:YOUR_PASSWORD -T FILE_TO_UPLOAD https://yourpasswordprotectedpage.com/your_destionation
-T, --upload-file <file>
curl -sD - -o /dev/null http://example.com
[3]- -s Avoid showing progress bar
- -D Dump headers to a file, but - sends it to stdout
- -o /dev/null Ignore response body
curl -XDELETE localhost:9200/index/type/documentID (Invoke-WebRequest -method DELETE http://localhost:9200/_all)
Offers the same features to fetch remote banner information from HTTP servers:
curl -s -I 192.168.0.15 | grep -e "Server: "
Other options:
-k, --insecure To accept self signed certificate -L, --location
Advance usage
- Use cURL to measure request and response times: https://stackoverflow.com/a/22625150
Related terms
See also
wget
,cURL
,links
,lynx
,elinks
,w3m
,httpie, opensearch-cli curl
,--no-check-certificate, wget --help
telnet
,netcat, nc, nc -l
,ncat
,socat, ngrok
- wget:
wget -r http://example.com/
iwr
(Invoke-WebRequest) PowerShell functionality- links (browser), lynx (browser), Elinks (browser) command line browsers
Advertising: