Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 88
    Much better than the accepted answer (which does a HEAD request).
    – neu242
    Commented Oct 2, 2014 at 10:05
  • 21
    Maybe obvious, but -i does work with any HTTP method, not just GET and POST... :)
    – mac
    Commented Oct 20, 2014 at 10:35
  • 9
    the best answer as it makes curl output both headers and body, making it suitable for most of the tasks when used in a script Commented Aug 31, 2015 at 19:52
  • 13
    This is the best answer, and can be used in conjunction with -s (don't show progress meter or error messages) and -S(do show error messages after all) Commented Feb 23, 2017 at 19:10
  • 8
    Sorry if one wants only the HTTP status code this answer is not doing that. pvandenberk's answer that sends the output to /dev/null` does output only the three digit HTTP code by then requesting only the HTTP code in the format output. Commented Feb 20, 2021 at 14:20