How can I use curl to print the location header in the response?

2 Replies, 1002 Views

Hey everyone,

So, I’m trying to figure out how to use curl to print the location header from a response. I’ve been messing around with it for a bit, but I can’t seem to get it right.

I know you can use `-I` to get the headers, but I only want the location header specifically. Is there a way to filter it out?

I tried something like `curl -s -o /dev/null -w "%{redirect_url}" http://example.com`, but it’s not giving me what I need. Am I missing something obvious?

Also, if anyone knows a quick way to curl print location header without all the extra stuff, that’d be awesome.

Thanks in advance!

Messages In This Thread
How can I use curl to print the location header in the response? - by - 23-08-2024, 12:45 PM



Users browsing this thread: 1 Guest(s)