cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to derive/capture the 301 url?

From: Roman Neuhauser <neuhauser+curl_at_sigpipe.cz>
Date: Mon, 12 Sep 2016 19:45:11 +0200

# badouglas_at_gmail.com / 2016-09-12 12:37:38 -0400:
> Morn.
>
> Simple (I hope question)..
>
> I can do a basic curl
> curl -v -A "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
> Firefox/45.0" --cookie-jar aa.lwp --cookie aa.lwp -L "
> http://case.bncollege.com"
>
> and I see the redirected url in the output stream... Short of crafting a
> bash script/process. Is there an easier way to get the 301/redirected url.
> In this case, the url is
>
> < HTTP/1.1 301 Moved Permanently
> < Location:
> http://case.bncollege.com/webapp/wcs/stores/servlet/BNCBHomePage?storeId=16053&catalogId=10001&langId=-1
>
> Is there a way to trigger off the "Location" in the returned headers?

you seem to be looking for the -w option, specifically %{redirect_url}.

-- 
roman
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-users
FAQ:        https://curl.haxx.se/docs/faq.html
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-09-12