# Generic request, just like wget. (v)erbose, (s)ilent, suppress progress bar meter
curl -vs http://remote.http.site
feel free to use --anyauth
or --negotiate
to properly match preferred auth.
Usually --anyauth
is preferred for basic realm
curl --anyauth --verbose --user 'username:password' "http://your.http.host.name/YOUR/REST/API"
You can use curl for retrieving the HTTP status code alone or have it combined with the usual stdout. For example"
# stdout AND http status code
curl -w "%{http_code}" "http://remote.http.site/whatever/URI/you/have"
# http status code only, quite handy in scripts
curl -w "%{http_code}" -o /dev/null "http://remote.http.site/whatever/URI/you/have"
curl \
--header "Authorization: key=AIzaSyAJdz6YkUNwb6lWtsyBV3XfhqldVHGUqtQ" \
--header Content-Type:"application/json" https://gcm-http.googleapis.com/gcm/send \
-d "{\"registration_ids\":[\"fARzJ0ysrZIxHpYSSg6wZTfURcuKwEGdCl0bku7n\"],\"data\":{\"title\":\"My Cool Title\"} }"
curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X POST http://localhost/form
# As a multipart (multipart/form-data)
curl -F "[email protected];filename=NameOfTheFileInPOST.txt" "http://remote.http.site/upload"
# As a binary file (application/x-www-form-urlencoded)
curl --request POST --data-binary "@bigfile.img" "http://remote.http.site/upload"
To force specific curl options, like --insecure
mode (do not care about untrusted certs) you might edit your $HOME/.curlrc
file.
for example:
insecure
in your .curlrc
file and everything is fine.