curl
Basic Usage
curl https://www.google.com
Use It Without Proxy
curl --noproxy "*" https://www.google.com
Verbose
Add -v or –verbose to the command. It will list out more information for your HTTP connection
-v, --verbose Make the operation more talkative
POST
Connect to a local server with username and password. (Should use HTTPS for production site)
curl --noproxy "*" -v http://127.0.0.1:8080/authenticate -d "username=username&password=password"
POST with JSON
Connect to a local server with username and password. (Should use HTTPS for production site). Note that for WINDOWS platform, single quote is not supported.
For Windows: curl --noproxy "*" -v -H "Content-Type: application/json" http://127.0.0.1:8080/authenticate -d "{\"username\":\"username\", \"password\": \"password\"}" For Other platform: curl --noproxy "*" -v -H "Content-Type: application/json" http://127.0.0.1:8080/authenticate -d '{"username": "username", "password": "password"}'
Adding Something in the HTTP header
This could be user for JWT, header authentication.
curl http://127.0.0.1:8080/ -H "Something: anything"
Connect to Self-signed SSL Site
add -k, or –insecure to the command.
-k, --insecure Allow insecure server connections when using SSL
Follow the URL
curl will not automatically redirect to a site like the browser does. In order to do it, add -L, or –location in the command
-L, --location Follow redirects