I am calling curl to website, checking what http status code and data if returns.
There are 2 cases:
- SUCCESS website HTTP status code: 200 (OK) data: none
needed result: CURL exiting with 0 unix status code
- FAILURE website HTTP status code: 4xx (error) - could be any data: text data
needed result: CURL exiting with error status code
For now there is used curl with -f modifier (silent).
curl https://mysite.com/something/deploy_status -f
It works great, because it checks the HTTP status code, and return unix error code (22) when there is any problem. However, I need to get also to get the text data, that is sent with error code.
How can I do that? Assume that I can make only one curl call, writing a script is not possible there.