title: curl 302 redirect not working (command line)
body: <p>In the browser, navigating to this URL initiates a 302 (moved temporarily) request which in turn downloads a file. </p>
  
  <blockquote>
    <p><a href="http://www.targetsite.com/target.php/?event=download&amp;task_id=123" rel="noreferrer">http://www.targetsite.com/target.php/?event=download&amp;task_id=123</a></p>
  </blockquote>
  
  <p>When I view what is actually happening via Chrome network tools I see that the redirect is going to a dynamically generated path that cancels itself immediately after download. In other words, even if I know that full path I will not have time to manually call it.</p>
  
  <p>So, how in using the command line can I mimic the browser actions?</p>
  
  <p>I tried</p>
  
  <blockquote>
    <p>curl --cookies bin/cookies.txt -O -L "<a href="http://www.targetsite.com/target.php/?event=download&amp;task_id=123" rel="noreferrer">http://www.targetsite.com/target.php/?event=download&amp;task_id=123</a>" --compressed</p>
  </blockquote>
  
  <p>but this just returns gibberish. The goal of this is to programmatically download this file without having to navigate to the site. Unfortunately I cannot share the site here as it is behind a log-in. </p>