Timeline for Getting only response header from HTTP POST using cURL
Current License: CC BY-SA 4.0
21 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 9, 2024 at 9:46 | comment | added | Hauke | Instead of redirecting the response body, it could be ommited using the -I option. I'm not sure if it is still sent, though. | |
| Jan 31, 2024 at 12:41 | comment | added | Anton Duzenko | This still prints response body with MINGW | |
| Feb 23, 2023 at 16:40 | history | edited | bfontaine | CC BY-SA 4.0 | remove -L: it’s just noise; it has nothing to do with the question. Keep it simple. |
| Aug 28, 2022 at 19:46 | comment | added | M. Justin | If for some reason you literally just want the headers and not the HTTP status code line (HTTP/1.1 200 OK), you can pipe it to tail: ` | tail -n +2` | |
| S Dec 19, 2017 at 22:42 | history | suggested | anapsix | CC BY-SA 3.0 | adding -L to follow redirects; and -S to show errors, if failing, to simplify debugging and avoid beating the head against the wall when "-s" silent option is selected |
| Dec 19, 2017 at 15:37 | review | Suggested edits | |||
| S Dec 19, 2017 at 22:42 | |||||
| Dec 19, 2017 at 15:29 | comment | added | anapsix | I'd add -L to follow redirects | |
| May 9, 2017 at 1:22 | comment | added | Alex78191 | @SatyaPrakash For me, $null writes to a file when cLink is installed. | |
| Oct 19, 2015 at 13:26 | comment | added | jakub.g | If you get empty output and you're targeting HTTPS, then you either need to provide a cert (--cacert), or use --insecure flag | |
| Jul 10, 2015 at 13:08 | comment | added | message | Or as helper function in bash function headers {curl -s -D - $1 -o /dev/null}. | |
| Apr 23, 2015 at 22:16 | comment | added | tlehman | Nice answer, I wrapped that in a bash function: github.com/tlehman/bin/blob/master/headers | |
| Aug 8, 2014 at 16:25 | comment | added | zmonteca | Dropping the -o /dev/null will get your entire response body PLUS header. Also useful IMO. | |
| May 30, 2014 at 16:38 | comment | added | steve | Man I'm never gonna remember all that. I guess I need to make an alias for this one since I frequently want to do this. :\ | |
| Nov 22, 2013 at 14:07 | history | edited | andrew cooke | CC BY-SA 3.0 | added 81 characters in body |
| Oct 29, 2013 at 10:33 | comment | added | andrew cooke | @mamachanko -D takes an argument that says where the output should go. the single dash means it should go to stdout. | |
| Oct 29, 2013 at 8:48 | comment | added | mamachanko | @WahidSadik Why's is that the case in particular? What's the function of the single dash? | |
| Oct 13, 2013 at 15:38 | comment | added | Wahid Sadik | The "-" in front of the URL may seem unimportant, but it's not. | |
| Sep 27, 2013 at 15:58 | comment | added | Satya Prakash | @JJS for me $null worked on Win7. Is it due to cLink installed on windows. | |
| Jul 15, 2013 at 21:45 | comment | added | JJS | above comment is valid if you're using powershell. for cmd.exe use curl -s -D - http://yahoo.com -o nul | |
| Apr 8, 2012 at 4:31 | vote | accept | Jonathan Allard | ||
| Jan 10, 2019 at 4:24 | |||||
| Apr 8, 2012 at 4:18 | history | answered | andrew cooke | CC BY-SA 3.0 |