To inspect response headers using cURL, utilize the following commands:
For a GET
request:
Unfortunately, this approach is limited to GET
requests. For POST
or other methods, employ the following command:
Refer to the manual for additional details:
-D, --dump-header <filename> Write the received headers to <filename>
-S, --show-error Show error even when -s is used
-s, --silent Silent mode
Please note the significance of the -
before the URL, indicating that the output redirects to stdout.
Here is an illustrative example:
Reference: https://stackoverflow.com/a/10060342/302974