Capture the HTTP status code from a curl command into a shell variable using the -w flag to distinguish server responses from network errors.