curl
is the fasted command-line tool to see how a URI (uniform resource identifier) responds. You can send any kind of web request (GET, PATCH, POST, PUT).
To send a quick GET request, you simply pass curl the URL you want to send a GET request to.
curl
It supports all kinds of protocols, including FTP, GOPHER, and various connection protocols like IMAP, SSH, SFTP, SMB, etc.
You’ll want to sit and read the manual page for curl. However, here are a few pointers to its options:
–dns-servers | Instead of using your network connection’s default DNS servers, instead use alternative DNS servers specified after this flag. Helpful for debugging DNS propagation. |
-d (or --data ) | If you specify a -d or –data flag, the form will be submitted to the endpoint as a POST request with Content-Type: application/x-www-form-urlencoded examples curl -d “name=abc” https://example.com curl -d “name=abc” -https://example.com curl -d @filename https://example.com The -d option overrides -F (--form ) and -I (--head ) and -T |
-I (or --head ) | Print ONLY the response headers; does not print the actual body of the response. |
-T (or –upload-file) | Used to upload a local file to your remote endpoint. A note from the docs: NOTE that you must use a trailing / on the last directory to really prove to Curl that there is no file name or curl will think that your last directory name is the remote file name to use. You can also use “globbing” here upload multiple files to a single URL by using the same, like this: curl --upload-file "{file1,file2}" http://www.example.com or even curl -T "img[1-1000].png" ftp://ftp.example.com/upload/ |
-F (or --form ) | Emulates what happens when a user submits a form. Specifically, sends the POST request with a request header of Content-Type: multipart/form-data |