else:curl

curl

curl https://www.google.com
curl --noproxy "*" https://www.google.com

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"}'

This could be user for JWT, header authentication.

curl http://127.0.0.1:8080/ -H "Something: anything"

add -k, or –insecure to the command.

-k, --insecure      Allow insecure server connections when using SSL

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
  • else/curl.txt
  • Last modified: 2020/08/07 16:33
  • by chongtin