Curl
Jump to navigation
Jump to search
Return status code only
curl -s -o /dev/null -w "%{http_code}" google.com
curl -s -o /dev/null -i -w "%{http_code}" google.com
curl -s -o /dev/null -I -w "%{http_code}" google.com
curl -s -o /dev/null -I -w "%{http_code}\n" google.com
ref: [1]
Return fail status code
curl --fail http://some-url.com echo $?
-f, --fail (HTTP) Fail silently (no output at all) on server errors