Troubleshooting of curl errors: Difference between revisions

Jump to navigation Jump to search
m
 
Line 408: Line 408:
To suppress the progress meter of the curl command, you can use the {{kbd | key=<nowiki>-s</nowiki>}} (silent) option, which hides all output, or the {{kbd | key=<nowiki>-S</nowiki>}} (silent with error messages) option, which suppresses the progress meter but still displays error messages.
To suppress the progress meter of the curl command, you can use the {{kbd | key=<nowiki>-s</nowiki>}} (silent) option, which hides all output, or the {{kbd | key=<nowiki>-S</nowiki>}} (silent with error messages) option, which suppresses the progress meter but still displays error messages.
<pre>
<pre>
curl -sS [URL]
curl -sSo file.pdf [URL]
</pre>
</pre>


Alternatively, if you prefer to suppress all output including error messages, use the {{kbd | key=<nowiki>-s</nowiki>}} (silent) option alone:
Alternatively, if you prefer to suppress all output including error messages, use the {{kbd | key=<nowiki>-s</nowiki>}} (silent) option alone:
<pre>
<pre>
curl -s [URL]
curl -so file.pdf [URL]
</pre>
</pre>


Suggestion:
Suggestion:
<pre>
<pre>
curl -sSf [URL]
curl -sSfo file.pdf [URL]
</pre>
</pre>
Adding {{kbd | key=<nowiki>-f</nowiki>}} causes curl to fail on HTTP errors (4xx, 5xx), making it the most robust option for scripts.
Adding {{kbd | key=<nowiki>-f</nowiki>}} causes curl to fail on HTTP errors (4xx, 5xx), making it the most robust option for scripts.

Navigation menu